Download & Extend

[TESTING BROKEN] FileFieldValidateTestCase fails randomly

Project:Drupal core
Version:7.x-dev
Component:file.module
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

The automatic test FileFieldValidateTestCase fail random..

In some patch that don't touch in FileField, or only in javascript, that nothing related with filefield have to be re-tested because the simpletest fail in FileFieldValidateTestCase

Error message:

FileFieldValidateTestCase 101 1 7
Message Group Filename Line Function Status
array_flip(): Can only flip STRING and INTEGER values! Warning entity.inc 108 DrupalDefaultEntityController->load()
Trying to get property of non-object Notice file.test 374 FileFieldValidateTestCase->testRequired()
Undefined property: stdClass::$uri Notice file.test 146 FileFieldTestCase->assertFileExists()
File exists after uploading to the required multiple value field. Other file.test 375 FileFieldValidateTestCase->testRequired()
Undefined property: stdClass::$fid Notice file.test 154 FileFieldTestCase->assertFileEntryExists()
array_flip(): Can only flip STRING and INTEGER values! Warning entity.inc 108 DrupalDefaultEntityController->load()
Trying to get property of non-object Notice file.test 156 FileFieldTestCase->assertFileEntryExists()
Undefined property: stdClass::$uri Notice file.test 156 FileFieldTestCase->assertFileEntryExists()

Comments

#2

Title:The automatic test FileFieldValidateTestCase fail random» The automatic test FileFieldValidateTestCase fail randomly

#3

I don't know if this is true, but automatic test should never be created with random content. The automatic test should be reproduced, exacly the same variables.

e.g. Instead be one variable with random content, should be 3 variables with static content, with that 3 variables with almost possible text.

#4

Priority:normal» critical

Test bot has been disabled until we can figure this out.
http://qa.drupal.org/node/68

#5

subscribe. nasty stuff.

#6

Title:The automatic test FileFieldValidateTestCase fail randomly» [TESTING BROKEN] FileFieldValidateTestCase fails randomly
Component:field system» file.module

Also investigated this today... I ran this test multiple times on my local machine (Windows), always passed 100%. AFAICS, the test does not seem to do anything scary.

What I didn't test is running tests in concurrency. Did anyone try this?

#7

also http://qa.drupal.org/pifr/test/23068

and a different failure is at http://qa.drupal.org/pifr/test/23044 (my own patch not related with FileField at all)
this case HAD (because now it passed) 2 fails and 14 exceptions, which might help to alight the issue
- 1 fail was "File exists after uploading to the required multiple value field." with 7 exception around like the other tests failing
- the other fail was similar but for for the single value field (also with 7 exceptions around it, the same exception's messages it got for the multiple value field)

#8

The probable culprit is FileFieldRevisionTestCase::testRevisions(). Files are shared between the test instances, and this test actually physically removes files.

The only correct fix is to copy all the test files to the new files directory in DrupalWebTestCase::setUp().

#9

Status:active» needs review

If I'm right, this should fix it.

AttachmentSizeStatusTest resultOperations
667264-random-file-related-failures.patch5.89 KBIdleUnable to apply patch 667264-random-file-related-failures.patchView details

#10

Status:needs review» active

from #drupal:

(16:56:04) beejeebus: anyone got any clues about reproducing that?
(17:17:07) DamZ: beejeebus: I think I know what's going on
(17:17:33) DamZ: beejeebus: it's probable that FileFieldRevisionTestCase::testRevisions() is running at the same time as the failing one
(17:18:07) DamZ: beejeebus: the files are shared, and FileFieldRevisionTestCase::testRevisions() is removing the file needed by FileFieldValidateTestCase
(17:55:13) beejeebus: DamZ: oh, its a concurrency issue?
(17:56:10) DamZ: beejeebus: yeah, of course
(17:56:58) beejeebus: DamZ: oh, that should be easy to fix then

#11

Status:active» needs review

Why changing the status?

#12

This is fairly ironic - unpatched filefield works fine for me, but the patched version runs into the similar errors as the test server.

Note the memory size failure claiming a memory limit of 64M, when the memory limit is actually set to 128M. This is unusual...

File field validation tests 92 passes, 10 fails, and 53 exceptions

Fail       PHP Fatal  database.inc                   1956                     
    Allowed memory size of 67108864 bytes exhausted (tried to allocate 48 bytes)
--
Exception  Notice     file.test                      29                       
    Trying to get property of non-object
Exception  Notice     file.test                      29                       
    Trying to get property of non-object
Exception  Notice     file.test                      104                      
    Undefined property: stdClass::$uri
--
Exception  Warning    entity.inc                     108                      
    array_flip(): Can only flip STRING and INTEGER values!
Exception  Notice     file.test                      410                      
    Trying to get property of non-object
Exception  Notice     file.test                      146                      
    Undefined property: stdClass::$uri
Fail       Other      file.test                      411                      
    File exists after uploading a file ( bytes) under the max limit (1M).
Exception  Notice     file.test                      154                      
    Undefined property: stdClass::$fid
Exception  Warning    entity.inc                     108                      
    array_flip(): Can only flip STRING and INTEGER values!
Exception  Notice     file.test                      156                      
    Trying to get property of non-object
Exception  Notice     file.test                      156                      
    Undefined property: stdClass::$uri
--
Exception  Notice     file.test                      104                      
    Undefined property: stdClass::$uri
--
Fail       Other      file.test                      417                      
    Node save failed when file ( bytes) exceeded the max upload size (1M).
Exception  Notice     file.test                      104                      
    Undefined property: stdClass::$uri
--
Exception  Warning    entity.inc                     108                      
    array_flip(): Can only flip STRING and INTEGER values!
Exception  Notice     file.test                      410                      
    Trying to get property of non-object
Exception  Notice     file.test                      146                      
    Undefined property: stdClass::$uri
Fail       Other      file.test                      411                      
    File exists after uploading a file ( bytes) under the max limit (1024K).
Exception  Notice     file.test                      154                      
    Undefined property: stdClass::$fid
Exception  Warning    entity.inc                     108                      
    array_flip(): Can only flip STRING and INTEGER values!
Exception  Notice     file.test                      156                      
    Trying to get property of non-object
Exception  Notice     file.test                      156                      
    Undefined property: stdClass::$uri
--
Exception  Notice     file.test                      104                      
    Undefined property: stdClass::$uri
--
Fail       Other      file.test                      417                      
    Node save failed when file ( bytes) exceeded the max upload size (1024K).
Exception  Notice     file.test                      104                      
    Undefined property: stdClass::$uri
--
Exception  Warning    entity.inc                     108                      
    array_flip(): Can only flip STRING and INTEGER values!
Exception  Notice     file.test                      410                      
    Trying to get property of non-object
Exception  Notice     file.test                      146                      
    Undefined property: stdClass::$uri
Fail       Other      file.test                      411                      
    File exists after uploading a file ( bytes) under the max limit (1048576).
Exception  Notice     file.test                      154                      
    Undefined property: stdClass::$fid
Exception  Warning    entity.inc                     108                      
    array_flip(): Can only flip STRING and INTEGER values!
Exception  Notice     file.test                      156                      
    Trying to get property of non-object
Exception  Notice     file.test                      156                      
    Undefined property: stdClass::$uri
--
Exception  Notice     file.test                      104                      
    Undefined property: stdClass::$uri
--
Fail       Other      file.test                      417                      
    Node save failed when file ( bytes) exceeded the max upload size (1048576).
Exception  Notice     file.test                      104                      
    Undefined property: stdClass::$uri
--
Exception  Warning    entity.inc                     108                      
    array_flip(): Can only flip STRING and INTEGER values!
Exception  Notice     file.test                      426                      
    Trying to get property of non-object
Exception  Notice     file.test                      146                      
    Undefined property: stdClass::$uri
Fail       Other      file.test                      427                      
    File exists after uploading a file ( bytes) with no max limit.
Exception  Notice     file.test                      154                      
    Undefined property: stdClass::$fid
Exception  Warning    entity.inc                     108                      
    array_flip(): Can only flip STRING and INTEGER values!
Exception  Notice     file.test                      156                      
    Trying to get property of non-object
Exception  Notice     file.test                      156                      
    Undefined property: stdClass::$uri
--
Exception  Notice     file.test                      29                       
    Trying to get property of non-object
Exception  Notice     file.test                      104                      
    Undefined property: stdClass::$uri
--
Exception  Notice     file.test                      453                      
    Undefined index:  und
Exception  Notice     file.test                      146                      
    Undefined property: stdClass::$uri
Fail       Other      file.test                      454                      
    File exists after uploading a file with no extension checking.
Exception  Notice     file.test                      154                      
    Undefined property: stdClass::$fid
Exception  Warning    entity.inc                     108                      
    array_flip(): Can only flip STRING and INTEGER values!
Exception  Notice     file.test                      156                      
    Trying to get property of non-object
Exception  Notice     file.test                      156                      
    Undefined property: stdClass::$uri
--
Exception  Notice     file.test                      104                      
    Undefined property: stdClass::$uri
--
Fail       Other      file.test                      463                      
    Node save failed when file uploaded with the wrong extension.
Exception  Notice     file.test                      104                      
    Undefined property: stdClass::$uri
--
Exception  Notice     file.test                      471                      
    Undefined index:  und
Exception  Notice     file.test                      146                      
    Undefined property: stdClass::$uri
Fail       Other      file.test                      472                      
    File exists after uploading a file with extension checking.
Exception  Notice     file.test                      154                      
    Undefined property: stdClass::$fid
Exception  Warning    entity.inc                     108                      
    array_flip(): Can only flip STRING and INTEGER values!
Exception  Notice     file.test                      156                      
    Trying to get property of non-object
Exception  Notice     file.test                      156                      
    Undefined property: stdClass::$uri

#13

Nice catch! I forgot to reset the copiedTestFiles indicator, so when several tests of the same class are run, files are only copied the first time.

This actually proves that the random errors in the test bot are actually due to a missing file.

AttachmentSizeStatusTest resultOperations
667264-random-file-related-failures.patch6.31 KBIdleUnable to apply patch 667264-random-file-related-failures_0.patchView details

#14

I can run the FileFieldValidateTestCase class with 102 passes and 0 fails, but I am not convinced the test completes, because there are three occurrences of

Fail       PHP Fatal  database.inc                   1956                     
    Allowed memory size of 67108864 bytes exhausted (tried to allocate 48 bytes)

Oddly, these failures do not get counted. Multiple different checks show that PHP's memory limit is set to 256M (and in fact any deliberately induced crashes elsewhere show a limit of 256MB was exceeded). This is weird.

#15

Okay, so here's what happens.

I have this file in the folder for whatever reason:

Array
(
    [sites/clean/files/simpletest/mpletest734835/error.log] => stdClass Object
        (
            [uri] => sites/clean/files/simpletest/mpletest734835/error.log
            [filename] => error.log
            [name] => error
        )

It contains this:

[23-Dec-2009 10:50:49] PHP Fatal error:  Allowed memory size of 67108864 bytes exhausted (tried to allocate 48 bytes) in /home/arancaytar/Documents/devel/drupal/core/CLEAN/includes/database/database.inc on line 1956

I've cleaned out and reinstalled my site now and hope that the error goes away.

Edit:

All is well. 102 passes, no failures, no exceptions, and the phantom fails are gone.

#16

superscribe

#17

Note that this is no longer the only test case that fails right now: #654854: Clean up conditions in comment_reply(), avoid node_view() when unnecessary.

#18

#19

In fact, there is no reason to pregenerate the files. The generation is fairly quick and those files are only used in a couple of tests. So I suggest we simply remove the pregeneration and generate the test files on-demand, the first time DrupalWebTestCase::drupalGetTestFiles() is called.

This should be more robust, and would avoid Arancaytar's issue where a phantom error.log was copied over and over to the new test environment.

AttachmentSizeStatusTest resultOperations
667264-random-file-related-failures.patch7.03 KBIdleUnable to apply patch 667264-random-file-related-failures_1.patchView details

#20

We should commit the #19 path, or remove the breaking test. The testbot can't be so long stopped.

#21

Status:needs review» fixed

Committed to CVS HEAD. Bring back the testbots p-uh-lease! Thanks DamZ.

#22

Status:fixed» needs review

This should fix the remaining test failures. Some tests were doing unholy things with the test files.

AttachmentSizeStatusTest resultOperations
667264-fix-remaining-failures.patch2.58 KBIdleUnable to apply patch 667264-fix-remaining-failures.patchView details

#23

Status:needs review» needs work

http://qa.drupal.org/pifr/test/32
Fail:
FileScanDirectoryTest (Found two, expected javascript files.)
ImageEffectsUnitTest (Division by zero)
ImageToolkitUnitTest (Division by zero)

#24

Status:needs work» needs review

cross post

#25

Cross-post.

#26

I ran the tests manually on qa-1 (my test slave). 100% pass.

#27

Status:needs review» fixed

Committed the patch in #22. Good thing we're making progress. Thanks @DamZ. :)

#28

Fixed issues should not be tested. should be automaticly removed from the queue.

#29

Title:[TESTING BROKEN] FileFieldValidateTestCase fails randomly» [TESTING BROKEN] FileFieldValidateTestCase (and FieldInfoTestCase?) fails randomly
Status:fixed» active

I believe that this error is still occurring but now with "FieldInfoTestCase" ...

the patch in comment #3 of #658148: The "access user profiles" permission is poorly named is nothing more then a find/replace on the string "access user profiles" but it is failing inexplicably on "FieldInfoTestCase"

I'm not 100% certain, but I suspect that its related to this issue ... thoughts?

#30

You have to find more 2 or 3 test fails like this..
But actualy is true, because the first test give the error, but re-tested don't give none.. But I don't find any issue with this problem

#31

#32

Title:[TESTING BROKEN] FileFieldValidateTestCase (and FieldInfoTestCase?) fails randomly» [TESTING BROKEN] FileFieldValidateTestCase fails randomly
Status:active» fixed

The error doesn't appear to be happening anymore. Even if it is, this would be an unrelated error because FieldInfoTestCase is not copying any files anywhere.

If a non-file-copying tests is failing erratically again, let's open a new issue.

#33

Status:fixed» closed (fixed)

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

nobody click here