Problem/Motivation
Download (Drupal\Tests\file\Functional\Download)
✔ Public file transfer
✘ Private file transfer without page cache
┐
├ Correctly denied access to a file when file_test sets the header to -1.
├ Failed asserting that 200 is identical to 403.
│
│ /builds/issue/drupal-3069442/core/modules/file/tests/src/Functional/DownloadTest.php:138
│ /builds/issue/drupal-3069442/core/modules/file/tests/src/Functional/DownloadTest.php:76
┴
✔ File create url
FAILURES!
Tests: 3, Assertions: 46, Failures: 1.
also
Download (Drupal\Tests\file\Functional\Download)
✔ Public file transfer
✘ Private file transfer without page cache
┐
├ Failed asserting that null matches expected 'private://wqelrzjx.txt'.
│
│ /builds/issue/drupal-3496529/core/modules/file/tests/src/Functional/DownloadTest.php:108
│ /builds/issue/drupal-3496529/core/modules/file/tests/src/Functional/DownloadTest.php:77
┴
✔ File create url
1 test triggered 1 PHP warning:
1) /builds/issue/drupal-3496529/core/modules/file/tests/src/Functional/DownloadTest.php:108
Trying to access array offset on null
Triggered by:
* Drupal\Tests\file\Functional\DownloadTest::testPrivateFileTransferWithoutPageCache (3 times)
/builds/issue/drupal-3496529/core/modules/file/tests/src/Functional/DownloadTest.php:76
FAILURES!
Tests: 3, Assertions: 37, Failures: 1, Warnings: 1.
Steps to reproduce
Example: https://git.drupalcode.org/issue/drupal-3069442/-/jobs/3468073#L526
Proposed resolution
Replace calls to State with calls to KeyValue.
The root cause of this issue is discussed in #3496257: Race conditions in CacheCollector/State (again)
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Comments
Comment #3
spokjeComment #11
spokjeComment #12
spokjeComment #13
spokjeComment #16
spokjeMR !10736 (which is
\Drupal\Tests\file\Functional\DownloadTest::doPrivateFileTransferTestand some pipeline changes to make it, and only it, run 7500 times) gives us 76 fails out of the 7500 runs.MR !10741 shows that changing \Drupal::state()->set()/get() to Drupal::keyValue()->set()/get(); passes a 7500 times run without errors.
Finally, MR!10746 is the one we want committed after review.
Comment #17
smustgrave commentedSame deal as others. #16 shows the net gain so lets do it!
Comment #18
catchhttps://git.drupalcode.org/project/drupal/-/merge_requests/10746/diffs is removing test coverage which looks unintentional?
Comment #19
acbramley commentedEncountered this twice in a row this morning, will try to tidy up the MRs here and get it back to NR.
Comment #20
acbramley commentedRebased and changed the get calls in the test to use
FileTestHelper::getCallsComment #21
godotislateSearched and found no other usages of
file_test.resultsorfile_test.returnin the code base. LGTM.Comment #23
catchCommitted/pushed to 11.x, thanks!