Problem/Motivation
In #3074993-31: Use "current" in update URLs instead of CORE_COMPATIBILITY to retrieve all future updates it became clear that our tests that extend \Drupal\FunctionalTests\Update\UpdatePathTestBase and some other tests make real calls out to updates.drupal.org that fetch XML. These test aren't actually meant to test this XML request. They just happen to make it.
If the requests aren't successful the tests don't fail because the test aren't asserting anything about the responses. If the requests are successful but the XML isn't in an expected format the test will fail.
So basically we are inadvertently testing the format of live XML on updates.drupal.org and these requests may be slowing down our test suite.
Proposed resolution
Make sure we aren't making calls to updates.drupal.org.
All tests that extend UpdatePathTestBase or otherwise would trigger requests to updates.drupal.org should actually be calling something like \Drupal\Tests\update\Functional\UpdateTestBase::refreshUpdateStatus() to change the update URL so we aren't making real requests to updates.drupal.org
Remaining tasks
all
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 3095755-6.patch | 2.09 KB | gábor hojtsy |
| #4 | 3095755-4.patch | 2.09 KB | gábor hojtsy |
Comments
Comment #2
tedbowshould have been
\Drupal\FunctionalTests\Update\UpdatePathTestBasein summary. updatingComment #3
dwwGreat find! Big +1 to doing what you propose.
Fixed a few grammar bugs and typos in the summary that made this harder to parse / understand.
Also copied over (and slightly edited for clarity) the proposed resolution from the end of #3074993-31: Use "current" in update URLs instead of CORE_COMPATIBILITY to retrieve all future updates:
Thanks!
-Derek
Comment #4
gábor hojtsyHm, I wanted to re-upload that patch from #3074993-31: Use "current" in update URLs instead of CORE_COMPATIBILITY to retrieve all future updates, to produce a list of tests that will fail. But I am not convinced. Since that is changing the suffix of the path to
/current, changing how the base path is calculated would not necessarily resolve the fails. I decided to took a go at this by changing out all code instances ofupdates.drupal.organd see what happens :)Comment #6
gábor hojtsyFix serialisation format. Curiously there were no other fails though.
Comment #7
gábor hojtsyComment #8
tedbow@Gábor Hojtsy yep. there are no fails because in all these tests we don't actually confirm the results of the update xml request.
#3074993: Use "current" in update URLs instead of CORE_COMPATIBILITY to retrieve all future updates failed because the XML was different than expected from updates.drupal.org and the test tries process the XML which leads undefined index problems.
Changing to example.com will just lead to failed to get updates. which doesn't actually fail test because it doesn't return any XML in a different format
Comment #9
gábor hojtsyHm, none of the tests that should fail check anything about the XML data or the contents of the XML data? Then what do they test about it?
Comment #10
tedbowSo for example
\Drupal\Tests\system\Functional\Update\UpdatePathTestBaseFilledTest::testPathAliasProcessing()fails with patch at #3074993-27: Use "current" in update URLs instead of CORE_COMPATIBILITY to retrieve all future updates.\Drupal\update\UpdateFetcher::fetchProjectData()is called because cron is run andupdate_cron()is called. So then\update_calculate_project_update_status()is ultimately called and gets the errorBecause it does receive XML from drupal.org but in an unexpected format.
So the test was not specifically testing the XML fetching and the returned XML from drupal.org but the call was being made.
In the patch in #6 the same happens up to
\Drupal\update\UpdateFetcher::fetchProjectData()but at that point butGets a 404 and then calls
watchdog_exception()this does not fail the test. No XML is fetched so we don't get the same error.I stepped debugged
\Drupal\Tests\system\Functional\Update\UpdatePathTestBaseFilledTest::testPathAliasProcessing()with both patches to be sure. I think it is likely the other 78 fails in #3074993-27: Use "current" in update URLs instead of CORE_COMPATIBILITY to retrieve all future updates are also becauseupdate_cronis run. So even when the Drupalci test can't connect to updates.drupal.org the test won't fail because the exception is caught.Comment #11
gábor hojtsyAh, ok. Thanks for the background. It is clearly more complicated than I expected.
Comment #12
xjmIs the correct status for this issue NW?
Comment #13
gábor hojtsyYes. The uploaded patch was more of a proof of fail and it did not even suffice at that.
Comment #20
dwwForgot about this issue, but just re-found it. Tagging to be smashed.
Comment #23
quietone commentedIs this still valid?
I just disconnected and ran the following tests that extend
\Drupal\FunctionalTests\Update\UpdatePathTestBaseand tests passed.