Closed (fixed)
Project:
Automatic Updates
Version:
8.x-2.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
7 Nov 2022 at 14:37 UTC
Updated:
15 Dec 2022 at 20:20 UTC
Jump to comment: Most recent, Most recent file

Comments
Comment #2
yash.rode commentedComment #3
yash.rode commentedComment #4
tedbow@yash.rode can run the full test suite locally and see what fails.
I think from our discussion more build tests are failing that just
CoreUpdateTest::testCronwe have a script
composer testthat will run all the tests.This will take a while but can you run this and post the results here.
thanks
After that I have an idea what might give us more information on the build tests.
you said
\Drupal\Tests\automatic_updates\Build\CoreUpdateTest::testUiis failing at$assert_session->pageTextContains('Ready to update');This could be the same error as in cron.
Before this assert line can you save the output of the page to a file and upload it here? I think it will show us that particular error.
Comment #5
tedbow@yash.rode thanks for filing the issue. Can you give some more context?
How did you set up the dev environment? Which version of PHP? Which version of composer do you have installed?
Are other tests in CoreUpdateTest failing or this the only one?
Also can search the project directory you are working with and test if there are any symlinks present?
find . -type l -lsworks for thisPlease provide as much information as you can, thanks.
Thanks
Comment #6
tedbowMy findings
I was able to re-produce a locally failing build tests in \Drupal\Tests\automatic_updates\Build\CoreUpdateTest.
I created a new dev environment with
scripts/setup_local_dev.shI ran the tests with
php core/scripts/run-tests.sh --sqlite /tmp/test.sqlite --url http://au-contrib.test --module automatic_updates --types PHPUnit-Build --verboseThe tests failed.
I think the problem is because in
\Drupal\Tests\package_manager\Build\TemplateProjectTestBase::createVendorRepositorywhich is used to make a the contents of thevendor.jsonfile it will put information about'drupal/core-vendor-hardening', 'drupal/core-project-message'core packages. It will only do this if you do not have these projects symlinked. Because of this lineif (is_dir($path) && !is_link($path)) {So in my local I had 2 environments, 1 that I had set up a long time ago with the projects
'drupal/core-vendor-hardening', 'drupal/core-project-message'symlinked and other that I made today withscripts/setup_local_dev.shin which these packages were in vendor but not symlinked.The problem is if
'drupal/core-vendor-hardening', 'drupal/core-project-message'are not symlinked in your local project then\Drupal\Tests\package_manager\Build\TemplateProjectTestBase::createVendorRepositorywill end up putting them invendor.jsonwith version 9.5.x-dev(or whatever your local branch of core is). This will cause build tests to fail becausecomposer create-projectcommand inside\Drupal\Tests\package_manager\Build\TemplateProjectTestBase::createTestProjectwill fail. We should never have reference you actual core clone version in our build. They currently simulate updating from 9.8.0 to 9.8.1. We picked this version because we assumed they would never actually be released.testing to see if you have the same problem
I think @yash.rode and @travis.carden had failing test after a fresh environment. I think @wim leers had local pasing tests.
If yall could try this out and report back. I would be interested to know the result for those who have failing build tests locally and those that passing build tests.
find . -type l. did this find any symlinks?protected $destroyBuild = FALSE;to\Drupal\Tests\automatic_updates\Build\CoreUpdateTestthis will make it so that build test does not destroy the workspace when the test is overphp core/scripts/run-tests.sh --sqlite /tmp/test.sqlite --url http://auto_updates_dev.test --module automatic_updates --types PHPUnit-Build --verbosereplacinghttp://auto_updates_dev.testhe URL for your local site. . Paste back the results of this into a comment on this issue, with answers to the other questions in this list/private/tmp/build_workspace_20e87df060f4016dfc26eda49609ef54GdEBBHit should havebuild_workspace_. in the name and then a random number. It should have been created very shortly after started the test. Make sure you get the recent one/private/tmp/build_workspace_20e87df060f4016dfc26eda49609ef54GdEBBH/vendor.jsonvendor.jsonin a code editordrupal/core-project-message"ordrupal/core-vendor-hardening? If so what "version" key is under those packages?The fix
I will upload a patch, 3319497-6-simple-fix.patch, for what fixed it for me. I also pushed my worked to https://github.com/tedbow/automatic_updates/tree/3319497-simple-fix
The solution for me was in
\Drupal\Tests\package_manager\Build\TemplateProjectTestBase::createVendorRepositoryto explicitly skip'drupal/core-vendor-hardening', 'drupal/core-project-message'packages. Right now I hard coded them but we can probably get these dynamically. We don't need them invendor.jsonas core itself will have information information about these packages.Please try this patch and then report again with the steps from "testing to see you have the same problem"
My fix not working for you?
If
3319497-6-simple-fix.patchdoes not fix your local tests I am also uploading3319045-build-events-assert-3319497-6.patch. This is the branch I was working on when I figured out the fix above. It has more changes that I removed because didn't think they were needed and the work from #3319045: Assert that all expected package manager events are fired during build tests.. They stuff I removed wasn't needed to fix my tests but if3319497-6-simple-fix.patchstill leaves you with failing build test, I would like to see if3319045-build-events-assert-3319497-6.patchwould fix them.if you tried out this patch please report again with the steps from "testing to see you have the same problem"
Comment #7
wim leersI did this.
I can confirm that this caused the problem.
In other words: the build tests fail because of
setup_local_dev.sh🙈 it indeed resulted inand that indeed caused this failure:
👆 Note that this indeed fails on
… which is what @yash.rode has been reporting for over a week now! 😬
So, applying the fix and running it again;
That worked!
Comment #8
wim leersGiven the painful process it required to get to #6, I think we ought to prevent this from ever happening again in the future, so created #3319679: Assert known preconditions for test runs and fail early if unmet.
IMHO we should add a
@seethat points to that issue — and for now, perhaps a@todo.Comment #9
tedbowActually the problem is that these packages that ship with Drupal core should never be added to vendor.json. Can explain in more detail later
Comment #10
tedbowAdded the todo to https://drupal.org/i/3319679. if tests pass will merge
Comment #11
tedbowugghh not remembering how to do patch files
Comment #13
tedbowComment #15
tedbow