Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I think this is probably due to a poor test, but when Testbot 953 was configured with 6.x-3.x, it confirmed successfully with a full D7 test, but fails 3 particular tests on d8:
* Drupal\file\Tests\DownloadTest->checkUrl(): Generated URL matches expected URL.
* Drupal\image\Tests\ImageStylesPathAndUrlTest->doImageStyleUrlAndPathTests(): When using non-clean URLS, the system path contains the script name.
I have disabled 953 for now; I'd love to have somebody sort out this in core.
Comment | File | Size | Author |
---|---|---|---|
#11 | run-tests-2150623.patch | 685 bytes | dawehner |
rfay_screenshot_ 2013-12-05 at 9.12.54 AM.png | 57.32 KB | rfay |
Comments
Comment #1
rfayI tested both of these manually on both a vagrant testbot and on 953. Neither failed.
Comment #2
rfayI just arranged a D8 test by 953 (which is enabled again, for now). It should probably be disabled if these same fails come back.
Comment #3
rfaySo this the DownloadTest failure is easily demonstrated using run-tests.sh...
sudo -u www-data /usr/bin/php ./core/scripts/run-tests.sh --concurrency 8 --php /usr/bin/php --url http://drupaltestbot953/checkout/ --verbose --class 'Drupal\file\Tests\DownloadTest'
I added an assertTrue() for debugging right before the failed test to find out what $url and $expected_url are, and they are different. But it wouldn't apparently have anything to do with the testbot.
The code in question is line 143 of https://api.drupal.org/api/drupal/core%21modules%21file%21lib%21Drupal%2...
Comment #4
rfaydrush si's default for clean_urls is ON. I think the default when installing via the traditional testbot was OFF.
Comment #5
rfayBased on testing by pwolanin and others, this appears to be a core bug. Manually running run-tests.sh as described above with drupal in a subdirectory *breaks*. Running it without the subdir succeeds.
I can't say why the old-style 6.x-2.x testbot does not demonstrate this.
Comment #6
rfayI put this as major because it's blocking an important testbot improvement. Change if you will.
Comment #7
pwolanin CreditAttribution: pwolanin commentedI'm guessing this is a bug with the way
$GLOBALS['base_url']
is constructed and hence used in file_create_url().I frankly don't even see at first blush how the test ever *can* work since the expected URL is generated with and without a clean URL flag, but I don't think the code in file_create_url() has any way to know about that flag.
Comment #8
rfayTagging random test failure. However, it's not random; This is easy to demonstrate using the run-tests.sh approach on a system where drupal is in a subdirectory.
It appears random only because we have a few testbots (running PIFR 6.x-3.x) that detect it, and many which do not (for no known reason)
Comment #9
pwolanin CreditAttribution: pwolanin commentedSo far, I'm not able to validate that - it looks like both
$GLOBALS['base_url']
and$file->getFileUri()
are the smae in the top and subdir scenariosComment #10
pwolanin CreditAttribution: pwolanin commentedOk, so to reconfirm:
When the test is run from a top-level URL includes the index.php
When run in a subdirectory, it does not.
In class PrivateStream I see a call to url():
url() makes use of the request object, which the test set up in
function prepareRequestForGenerator()
and sets into the generator.That function has a @todo and some code for handling the cli test runner, so I'm guessing the bug is there somewho.
Comment #11
dawehnerWe figured out that /checkout/ does not work while /checkout does work.
The code responsible for generating the base url takes the $_SERVER['SERVER_FILENAME']
which is set by run-tests.sh:
so you will end up with two right slashes. Trim the path, if available fixes the problem.
Comment #12
pwolanin CreditAttribution: pwolanin commentedFixes the test behavior for me locally
Comment #13
rfayThanks so much to both of you. The fix is also now in pifr 6.x-3.x, so it generates a run-tests.sh url with no trailing /.
Comment #14
webchickGreat sleuthing work, you two! :D
Committed and pushed to 8.x. Thanks!