It's a clean install of Drupal 7 CVS 30/07/2009.

Running the simpletest I have: one fail in Blog, and one crash error.

Fail in blog:
Users blog displayed with no entries Other blog.test 54 BlogTestCase->testBlogPageNoEntries()

Crash error:

An error occurred.
Path: /batch?id=2&op=do
Message: PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'field_name' at row 1: INSERT INTO {field_config} (field_name, type, locked, data, module, cardinality, active, deleted) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7); Array
(
[:db_insert_placeholder_0] => drupal_s7262919eyte9wf_field_name
[:db_insert_placeholder_1] => test_field
[:db_insert_placeholder_2] => 0
[:db_insert_placeholder_3] => a:2:{s:8:"settings";a:1:{s:18:"test_field_setting";s:17:"dummy test string";}s:7:"indexes";a:1:{s:5:"value";a:1:{i:0;s:5:"value";}}}
[:db_insert_placeholder_4] => field_test
[:db_insert_placeholder_5] => 4
[:db_insert_placeholder_6] => 1
[:db_insert_placeholder_7] => 0
)
in drupal_write_record() (line 4547 of /persistent/home/int/sites/drupal7/includes/common.inc).
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Damien Tournoud’s picture

Status: Active » Postponed (maintainer needs more info)

Please tell us more about your environment (types and versions of your webserver, PHP, and database engine).

int’s picture

Status: Postponed (maintainer needs more info) » Active

The crash error is in field's.

MySQL: 5.1.30really5.0.75-0ubuntu10 (InnoDB)
PHP:5.2.6-3ubuntu4.1
webserver: Apache/2.2.11 (Ubuntu) PHP/5.2.6-3ubuntu4.1 with Suhosin-Patch

int’s picture

Now nothing work's.

I "Clean (the) test environment" with the button, and I run anyone.. but none work's..

See:

An error occurred.
Path: /batch?id=13&op=do
Message: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupal7.drupal_simpletest705302cache_update' doesn't exist: SELECT data, created, expire, serialized FROM {cache_update} WHERE cid = :cid; Array
(
[:cid] => update_available_releases
)
in _update_cache_get() (line 585 of /persistent/home/int/sites/drupal7/modules/update/update.module).

I go back to the DB and I have this simpletest tables:

drupal_simpletest705302actions
drupal_simpletest705302actions_aid
drupal_simpletest705302authmap
drupal_simpletest705302batch
drupal_simpletest705302blocked_ips
drupal_simpletest705302cache
drupal_simpletest705302cache_filter
drupal_simpletest705302cache_form
drupal_simpletest705302cache_menu
drupal_simpletest705302cache_page
drupal_simpletest705302cache_path
drupal_simpletest705302cache_registry
drupal_simpletest705302files
drupal_simpletest705302filter
drupal_simpletest705302filter_format
drupal_simpletest705302flood
drupal_simpletest705302history
drupal_simpletest705302menu_links
drupal_simpletest705302menu_router
drupal_simpletest705302node
drupal_simpletest705302node_access
drupal_simpletest705302node_revision
drupal_simpletest705302node_type
drupal_simpletest705302queue
drupal_simpletest705302queue_consumer_id
drupal_simpletest705302registry
drupal_simpletest705302registry_file
drupal_simpletest705302role
drupal_simpletest705302role_permission
drupal_simpletest705302sessions
drupal_simpletest705302system
drupal_simpletest705302url_alias
drupal_simpletest705302users
drupal_simpletest705302users_roles
drupal_simpletest705302variable

Don't exists this table: drupal_simpletest705302cache_update

int’s picture

I desactivated the CVS Deploy module, and now I can run simpletest again.. (may one error or the cache was cleaned)

But the errors in the 1first post still happen.

int’s picture

I continue to test the others tests without the field test, and give me more fails:

Enable/disable modules: 49 passes, 4 fails, and 0 exceptions
SimpleTest functionality: 67 passes, 17 fails, and 34 exceptions

Damien Tournoud’s picture

Cannot reproduce. Is there something special in your configuration? I have never seen MySQL returning a "Data too long for column" error.

int’s picture

I don't think so.

I have Ubuntu 9.04 (in Amazon EC2)

The error when I test the simpletest.test

SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name 'drupal_simpletest214638simpletest705224taxonomy_vocabulary_node_type': CREATE TABLE {taxonomy_vocabulary_node_type} ( `vid` INT unsigned NOT NULL DEFAULT 0 COMMENT 'Primary Key: the drupal_simpletest214638simpletest705224taxonomy_vocabulary.vid of the vocabulary.', `type` VARCHAR(32) NOT NULL DEFAULT '' COMMENT 'The drupal_simpletest214638simpletest705224node.type of the node type for which the vocabulary may be used.', PRIMARY KEY (type, vid), INDEX vid (vid) ) ENGINE = InnoDB DEFAULT CHARACTER SET UTF8 COMMENT 'Stores which node types vocabularies may be used with.'; Array ( ) 	PDOException	database.inc	2096	db_create_table()

Edited: maybe is because the Ubuntu PHP use by default "Suhosin-Patch"

int’s picture

@Damien Tournoud I know why I have this errors :)

The table {field_config}.field_name have 32 chars.. But the string that want to insert is 33 chars. ("drupal_s7262919eyte9wf_field_name")
So why this happen only with me? because I have the drupal_prefix: drupal_

So we have to recheck all tables, or change the string. And put the simpletest to allways test with one random drupal prefix.

int’s picture

Title: Tests in Drupal 7 don't work.. » Tests in Drupal 7 don't work if drupal have table prefix.

Change the title.

I don't know if with the table prefix will we also find others errors.

int’s picture

Title: Tests in Drupal 7 don't work if drupal have table prefix. » Tests in Drupal 7 don't work if drupal have table prefix
Assigned: int » Unassigned
boombatower’s picture

Title: Tests in Drupal 7 don't work if drupal have table prefix » Field tests do not need to append strings to randomly generated strings
Component: simpletest.module » field system
Assigned: Unassigned » boombatower
Status: Active » Needs review
FileSize
1.12 KB

There is not need to append strings to randomly generated strings (unless test uses the suffix _field_name instead of looking for the whole thing). This should obviously still generate really long strings is db prefix is longer. Perhaps we should generate only include the SimpleTest part of the prefix since it is only being added to ensure uniqueness.

int’s picture

Title: Use only the generated part of the database prefix when generating random strings » Field tests do not need to append strings to randomly generated strings
Component: simpletest.module » field system

@boombatower are you sure that this patch resolve all drupal prefix problems?
you are only changing the field.test and this issue is about all simplestest.

I think that you are only remove 11 fixed chars, but the table prefix can have more (and is dynamic), so you are fix nothing..

With this patch resolve the field error with drupal_ prefix, if I have www_site_example_org_ maybe will give that error again.

boombatower’s picture

Component: field system » simpletest.module
FileSize
1.99 KB

Right, which is what I commented on. Better patch.

boombatower’s picture

Title: Field tests do not need to append strings to randomly generated strings » Use only the generated part of the database prefix when generating random strings

Title: Field tests do not need to append strings to randomly generated strings » Use only the generated part of the database prefix when generating random strings
Component: field system » simpletest.module
Status: Needs review » Needs work

The last submitted patch failed testing.

int’s picture

This patch only work for this two modules:
blog.test Now work
field.test Now work

But don't fix all errors and introduce others.

And I think that we may want to change testing.drupal.org to test also with one table prefix.

boombatower’s picture

Status: Needs work » Needs review
FileSize
2.54 KB

Took me a bit to track down upload error.

boombatower’s picture

I am going to install Drupal in prefix of drupal_ as you have see what I get, I can't see why this would introduce more errors that testbot doesn't see.

int’s picture

@boombatower with patch #17 I don't have errors, but I'm still testing

boombatower’s picture

I am going to install Drupal in prefix of drupal_ as you have see what I get, I can't see why this would introduce more errors that testbot doesn't see.

boombatower’s picture

Doesn't seem to create any problems (obviously didn't run all tests).

int’s picture

An error occurred.
Path: /batch?id=36&op=do
Message: PDOException: SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name 'drupal_simpletest283883field_revision_t283883to37bnts_field_name_2': CREATE TABLE {field_revision_t283883to37bnts_field_name_2} (
`etid` INT unsigned NOT NULL COMMENT 'The entity type id this data is attached to',
`bundle` VARCHAR(32) NOT NULL DEFAULT '' COMMENT 'The field instance bundle to which this row belongs, used when deleting a field instance',
`deleted` TINYINT NOT NULL DEFAULT 0 COMMENT 'A boolean indicating whether this data item has been deleted',
`entity_id` INT unsigned NOT NULL COMMENT 'The entity id this data is attached to',
`revision_id` INT unsigned DEFAULT NULL COMMENT 'The entity revision id this data is attached to, or NULL if the entity type is not versioned',
`delta` INT unsigned NOT NULL COMMENT 'The sequence number for this data item, used for multi-value fields',
`t283883to37bnts_field_name_value` TINYINT DEFAULT NULL,
PRIMARY KEY (etid, revision_id, deleted, delta),
INDEX t283883to37bnts_field_name_value (t283883to37bnts_field_name_value)
) ENGINE = InnoDB DEFAULT CHARACTER SET UTF8 COMMENT 'Revision archive storage for field 2 ...'; Array
(
)
in db_create_table() (line 2096 of /persistent/home/int/sites/drupal7/includes/database/database.inc).
boombatower’s picture

I get the feeling that is unrelated to this patch and probably always occured for you.

int’s picture

@boombatower, yes for sure.. I allready have this error in the #7 post.

But this error probably is also about table prefix..

I have errors in is two test:
Enable/disable modules
Simpletest

boombatower’s picture

I am not sure how much further to take this, or if it makes sense to. Removing the host prefix from the randomName() method makes sense, but to do so from all table names is not a good idea. It would seem that is the issue you are having. We may just be running into the limits that database set. As such, either the tests themselves can be tweaked...or SimpleTest just won't work on a prefixed host for all test.

boombatower’s picture

Applied the removal of host prefix to randomString() as well.

int’s picture

Status: Needs review » Reviewed & tested by the community

Still apply to HEAD, and work.

mgifford’s picture

I just applied this patch:
patch -p0 < 535440-shorten-random_1.patch

Got this nasty error:

An error occurred.
Path: /drupal-cvs/batch?id=3&op=do
Message: PDOException: SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name 'abcdefghijklmnosimpletest90237field_data_t90237namoummj_field_name_2': CREATE TABLE {field_data_t90237namoummj_field_name_2} (
`etid` INT unsigned NOT NULL COMMENT 'The entity type id this data is attached to',
`bundle` VARCHAR(32) NOT NULL DEFAULT '' COMMENT 'The field instance bundle to which this row belongs, used when deleting a field instance',
`deleted` TINYINT NOT NULL DEFAULT 0 COMMENT 'A boolean indicating whether this data item has been deleted',
`entity_id` INT unsigned NOT NULL COMMENT 'The entity id this data is attached to',
`revision_id` INT unsigned DEFAULT NULL COMMENT 'The entity revision id this data is attached to, or NULL if the entity type is not versioned',
`delta` INT unsigned NOT NULL COMMENT 'The sequence number for this data item, used for multi-value fields',
`language` VARCHAR(32) NOT NULL DEFAULT '' COMMENT 'The language for this data item.',
`t90237namoummj_field_name_value` TINYINT DEFAULT NULL,
PRIMARY KEY (`etid`, `entity_id`, `deleted`, `delta`, `language`),
INDEX `t90237namoummj_field_name_value` (`t90237namoummj_field_name_value`)
) ENGINE = InnoDB DEFAULT CHARACTER SET UTF8 COMMENT 'Data storage for field 2 (t90237namoummj_field_name)'; Array
(
)
in db_create_table() (line 2133 of /Applications/MAMP/htdocs/drupal-cvs/includes/database/database.inc).

Which is worse than the previous nasty error I got:

An error occurred.
Path: /drupal-cvs/batch?id=2&op=do
Message: FieldException: Attempt to create a field with a name longer than 32 characters: <em>abcdefghijklmnos628849vp2uf95q_field_name</em> in field_create_field() (line 222 of /Applications/MAMP/htdocs/drupal-cvs/modules/field/field.crud.inc)

and continuing on to the "Please continue to the error page" error page link now just gives me:

Error message No active batch.

I'm very frustrated with simpleTests right now. It's a system with a lot of potential, but...

int’s picture

Status: Reviewed & tested by the community » Needs work

Yes, you are correct.

The patch still apply to the HEAD but now don't fix the error.. Something change since 1 August.

cburschka’s picture

int’s picture

Assigned: boombatower » Unassigned
c960657’s picture

Why is the $db_prefix added to the random strings in the first place? This was introduced in #295864: SimpleTest: Change randomName() method to randomString() but without any real explanation AFAICT. Previously randomName() had a prefix argument that allowed each caller to get their own prefix, but prefixing all strings in a test with the same prefix seems doesn't seem to have a good purpose, does it?

cburschka’s picture

No, it doesn't. All it does is cause two problems in several places:

a.) The strings are way too big for database tables, and other things (drupal_simpletest19344_field_something_something_drupal_simpletest19344, wtf?)
b.) The strings are longer than the length that the caller asks for. This has actually resulted in a test passing when it should have failed, on a 255 character boundary issue.

Can we please make these prefixes just disappear entirely from the random functions?

c960657’s picture

Status: Needs work » Needs review
FileSize
1.75 KB

This patch strips the prefix from the random strings.

Status: Needs review » Needs work

The last submitted patch, pure-randomness-1.patch, failed testing.

c960657’s picture

Status: Needs work » Needs review
FileSize
21.22 KB

Now that randomName() does not add a prefix, we need to make sure that field names do not start with a digit.

carlos8f’s picture

Easier to just have randomName() start the string with a letter.

carlos8f’s picture

global $db_prefix is not needed in those functions, either.

Status: Needs review » Needs work

The last submitted patch, simpletest-random-strings-cleanup.2.patch, failed testing.

carlos8f’s picture

Hmm, there is no functional difference between #40 and $41, so why the failures? Perhaps it is because the strings are actually random now, rather than having a predictable prefix.

Status: Needs work » Needs review

Re-test of simpletest-random-strings-cleanup.2.patch from comment #41 was requested by int.

int’s picture

you can allways re-tested.. but if this time it pass.. and the problems isn't from the bot itseft.. we should remove the randomtest and create 3 or more static tests..

carlos8f’s picture

Status: Needs review » Needs work

Yes, there is a peculiar problem now because the tests fail only some of the time when randomName() and randomString() return truly random strings. This would take a lot of trial and error to work out due to the chancy nature of the failures. I would assume the failing tests have design flaws, since randomName() etc should actually return a random string, not a $db_prefix + random string.

Re-test of simpletest-random-strings-cleanup.2.patch from comment #41 was requested by carlos8f.

boombatower’s picture

Status: Needs work » Reviewed & tested by the community

/me likes

carlos8f’s picture

Status: Reviewed & tested by the community » Needs work

Hold it! This patch has been documented to make some tests fail non-reliably, and #41 was re-tested before I could document what the fails were. It indicates that some tests in our suite are written under false assumptions that randomName() and randomString() have 1) a certain minimum length and 2) a predictable prefix. Since we are removing that, we need to run tests over and over to determine which ones need tweaking.

boombatower’s picture

Sounds fun.

Perhaps just make a couple of patches the generate strings with small count (min), max, etc. I'm sure you can figure it out ;)

Status: Needs work » Needs review

Re-test of simpletest-random-strings-cleanup.2.patch from comment #41 was requested by carlos8f.

carlos8f’s picture

Title: Use only the generated part of the database prefix when generating random strings » Random strings in SimpleTest should not contain $db_prefix
Priority: Critical » Normal
Status: Needs review » Needs work

This isn't a show-stopper, since it only affects tests and tests are done in a controlled environment anyway. Still would be nice to work out though.

Status: Needs work » Needs review

Re-test of simpletest-random-strings-cleanup.2.patch from comment #41 was requested by carlos8f.

andypost’s picture

Status: Needs review » Needs work

@carlos8f What for you change dblog.test ? checkplain for limited set of ascii chars? and limit to 4?

c960657’s picture

The changes to DBLog are actually just a workaround for #718662: DBLog listings truncate messages in the middle of HTML tags (I did not realize this entirely when I wrote the patch in comment #37).

It's a bit tricky: When the username is 8 characters long (with the patch in this issue, randomName() by default returns 8 characters instead of a much longer string), the test looks for Session opened for <em class="placeholder">rtBXvJNp</em> (56 characters). However, the real string in user.module is Session opened for <em class="placeholder">rtBXvJNp</em>. (57 characters - note the trailing period), and that is truncated to Session opened for <em ..., i.e. the test now fails. Without the patch, randomName() returned a longer string that were truncated in both cases.

We should probably wait for that bug to land before proceeding in this issue.

andypost’s picture

So waiting for someone to re-roll patch and there's enough people to RTBC :)

andypost’s picture

Status: Needs work » Needs review
FileSize
3.21 KB

Status: Needs review » Needs work

The last submitted patch, 535440_simpletest_random_d7.patch, failed testing.

andypost’s picture

Status: Needs work » Needs review
FileSize
4.31 KB

Re-roll with fix for search tests - use explicit "search string" else string could be partially displayed so test will fall randomly...

Still depends on #718662: DBLog listings truncate messages in the middle of HTML tags

Status: Needs review » Needs work

The last submitted patch, 535440_simpletest_random_d7.patch, failed testing.

andypost’s picture

Status: Needs work » Needs review

#59: 535440_simpletest_random_d7.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 535440_simpletest_random_d7.patch, failed testing.

andypost’s picture

Status: Needs work » Needs review
FileSize
4.97 KB

Search comment tests changed to use exactly "Test comment subject" and "Test comment body" because using random{Name|String} could produce names that less then 3 chars so brings random test fails.

Also limited username in dblog tests, suppose this change has more priority then #718662: DBLog listings truncate messages in the middle of HTML tags

andypost’s picture

Now patch stably performs tests!

boombatower’s picture

Status: Needs review » Reviewed & tested by the community
Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.