Closed (fixed)
Project:
Drupal core
Version:
8.9.x-dev
Component:
phpunit
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Oct 2019 at 21:57 UTC
Updated:
22 Feb 2020 at 04:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mile23Initial patch.
I get a lot of errors trying to chmod and cleanup the workspace directory. Let's see if the testbot fares better.
Comment #4
greg.1.anderson commentedI don't know if this happened in the same time window where there was a similar test failure in HEAD of 8.8.x. I'd imagine you'd have other failures in the scaffold tests if that were the case, but I thought I'd call it out anyway.
https://www.drupal.org/project/drupal/issues/3085697#comment-13291515
Comment #5
mile23I'm pretty sure my local fails were/are related to the problem in #3082866: composer complains "Skipped installation of bin bin/composer for package composer/composer: file not found in package". So we really should work on getting that issue fixed.
Somehow the testbot filesystem seems much more forgiving of that dangling alias, however.
Anyway, this patch converts the test to use a dataProvider, so we can better identify which test is failing. Also I've modified drupalci.yml to get some quicker test results for the build test. We'll need to revert that change before committing.
Comment #6
mile23Ready for prime time. Reverted drupalci.yml, removed errant error_log().
Comment #7
mile23I reverted drupalci.yml but neglected to remove the part that runs the script that is, you know... the point of this issue.
Comment #8
greg.1.anderson commentedThis is looking pretty good to me. We aren't blocked on #3082866: composer complains "Skipped installation of bin bin/composer for package composer/composer: file not found in package" or anything, are we?
The work in #3082230: [meta] Convert some tests to Build tests looks like it will be helpful for continuations after this issue.
Comment #9
mile23Re #8: The testbot seems to not care that there is a dangling composer alias, so I don't think #3082866: composer complains "Skipped installation of bin bin/composer for package composer/composer: file not found in package" is a blocker. Just something that would be better to have sooner, rather than later.
Comment #10
greg.1.anderson commentedIt is important to add a path repository for the scaffold plugin before installing the recommended and legacy template projects. If you do not, then the test will run against the scaffold plugin registered with Packagist instead of the one bundled with the current patch. This causes failures if the behavior of the scaffold plugin and its tests are changed at the same time (and masks failures if the behavior changes without updated tests).
The existing code does not create a path repository for the vendor hardening plugin, but it should for the same reason. It would not hurt to add a path repository for the vendor hardening plugin invariantly, as it will be ignored if the vendor hardening plugin is not required (e.g. in the recommended project)
Another issue is that this took 33 minutes to run locally (just this one test, not even all of the Scaffold group) -- I'm not sure why it was that slow, as it only took 5m on Jenkins. We might still consider removing
@group Scaffoldfrom this test, so that it is only included in the build test group. It's probably better to not run this test when running just--group Scaffoldtests locally.Comment #11
greg.1.anderson commentedIn #10, I know that the line I quoted should be removed, as that whole script is being replaced. We need an equivalent line in the build test version (or manipulate the composer.json in php if preferred, but I think that the composer config technique is better).
Comment #12
mile23#10 oh yikes, I totally missed that. Interesting that it passes anyway.
Comment #13
mile23This patch adds a
composer create-projecttest as well, and adds@group #slow. This way you can callphpunit --exclude-group #slowif you want to skip the big builds.I think the create-project test is the actual test here. Opinions?
It still fails locally based on #3082866: composer complains "Skipped installation of bin bin/composer for package composer/composer: file not found in package" but I wager the testbot won't fail.
It takes ~6 minutes to run locally.
Comment #14
mile23Comment #16
Mixologicokay, so the issue we discovered in #slack was that these tests rely on drupal/core-recommended (and to some degree the other metapackages)
If we make changes to core's composer.lock file, these tests will pass, _until that change to the lockfile is committed_ and then they will not pass until such time as the drupal/core-recommended gets updated.
Which also means its not actually being tested until after the fact.
So, the only way we'll be able to test something that rely's on the metapackages is to have the packages in core, probably generated by a composer script that fires off every time the lockfile is generated.
Comment #17
mile23A few things here.
We did a sort of emergency script-ectomy of the shell script here, because it was being disruptive: #3087219: Remove broken test for composer templates
That will necessitate a re-roll here.
We also discussed the fails in #13.
The testbot does the right thing and symlinks these packages during the install test.
Locally, I found that it checking out the packages which is why we have this assertion:
That assertion is incorrect, and should instead reflect the symlinking in this line:
The changes in #3087219: Remove broken test for composer templates came about because while these tests use a path repo for in-core dependencies, we can’t use a path repo for the drupal/core-recommended metapackage. If there is a change to the core repo’s composer.lock file that hasn’t yet been used to generate a new drupal/core-recommended package, we have to assume that the test will fail. (Because it did in this case.)
This led to a failing HEAD, which was a big problem because today is the day before alpha for Drupal 8.8.x :-)
So to mitigate this, we discussed replacing a dependency on drupal/core-recommended with drupal/core. This will mitigate the lag in generating drupal/core-recommended, but at the same time makes a test that doesn’t reflect a complete build of the template package.
Until this conundrum is solved, we’ll pursue ‘good enough’ with this change.
And of course we still have a fail related to #3082866: composer complains "Skipped installation of bin bin/composer for package composer/composer: file not found in package"
Comment #18
greg.1.anderson commentedActually, although I did not think of this before, we potentially could generate a drupal/core-recommended metapackage on-the-fly, just for testing, and make a path repository that points to the temporary directory containing the result.
This is not a great idea, though, because there is no guarantee that the on-the-fly drupal/core-recommended will come out the same as the package generate version of the same package. It would therefore still be better to convert drupal/core-recommended to become a subtree split (modified at composer create time), as we could then generate a path repository to point at the exact thing that the subtree splitter will use to make the external project.
Comment #19
mile23This is me experimenting trying to get local to do the right thing with symlinks. I never succeeded, but I'm curious what the testbot will do.
Modified drupalci.yml to only run build tests.
Comment #22
mile23It seems our luck has changed and we're postponed here on #3082866: composer complains "Skipped installation of bin bin/composer for package composer/composer: file not found in package"
Also we def want this in 8.8.x because it's our only test of the composer templates, and they were disabled after breaking HEAD: #3087219: Remove broken test for composer templates
Comment #23
greg.1.anderson commentedWe are also postponed on #3087626: Convert drupal/core-recommended & c. into a subtree split, because otherwise we will prevent updates to composer.lock from working (the composer.lock update will work, but tests will fail).
Comment #24
mile23I experimented with writing this patch with #3087626-4: Convert drupal/core-recommended & c. into a subtree split added, so I can confirm that we're still blocked on that.
But the other thing I discovered is that the install test is pretty fragile once we try to include all the special cases needed to make it work here. To the point that it's not really a test any more. For instance: drupal/recommended-project requires drupal/core-recommended ^8.8, which we have to change to self.version in order to perform an install using the local codebase.
After talking to @greg.1.anderson about it in Slack, we decided the create-project is the real test here, and that we can remove testTemplateInstalls().
Comment #25
mile23#3087626: Convert drupal/core-recommended & c. into a subtree split is in, so this can move forward.
Comment #26
mile23It turns out that if you specify a packages.json file on the command line with composer create-project, that packages.json file only applies towards the discovery of the project template you want to create, and not its dependencies.
So here we add path repos to the project templates, because we have to. Otherwise Composer will seek the dependencies from packagist and/or Drupal facade.
Moved the test to the Templates namespace since it's not a test of the scaffold plugin.
Also targeting to 8.9.x, but we'll need to backport this to 8.8.x.
Comment #27
jibranWow package.json approach is quite clever. Testbot came back green so RTBC.
Comment #28
jibranComment #29
greg.1.anderson commentedAwesome. RTBC x 2.
Comment #30
mile23One of the saddest things in the world is that it works, you submit the patch, you go back to fix a comment you forgot to delete, and then it doesn't work any more.
That's supposed to be a symlink.
Anyway, I'm currently trying to make this test prove that it used symlinks when it was supposed to.
Any other suggestions for assertions about the validity of the installed code are welcome.
Comment #31
greg.1.anderson commented$this->assertTrue(is_link(...));?Comment #32
MixologicComment #33
mile23I worked as hard as I could to not make any specific version requirements necessary for this test, but we do have to specify them, and in fact it's a necessary test.
As an example... In 9.0.x, drupal/recommended-project currently says it needs drupal/core-recommended ^8.8. Since it also has minimum stability as dev, and also prefers stable, it will use 8.8.0-alpha1 for drupal/core-recommended.
So therefore this test already shows us that our templates need fixing, which I've done here with updating the minimum versions in the templates.
Here are patches for 8.9.x and 9.0.x.
The differences between 8.9.x and 9.0.x are in the minimum version specification for the templates, the packages.json fixture, and a single variable in the test so we only have to maintain it in one place there.
We'll reroll for 8.8.x later, because this should be in 8.8.x.
Comment #34
jibranLet's add the 8.8.x patch at the same time so that committer can commit it in one go.
It is becoming increasingly evident that we need a new constant for this in core. Let's make it a class constant at least for now.
HINT: We can call it
\Drupal::COMPOSER_CORE_VERSION.Comment #35
greg.1.anderson commentedI think that the core committers have a meeting where they discuss the 8.8.x backports for patches that are committed to 8.9.x, so it's not possible to commit to all three branches at once. Given this, it's probably better to make just two patches, & not make the 8.8.x until the 8.9.x is committed.
Comment #36
greg.1.anderson commentedRegarding
\Drupal::COMPOSER_CORE_VERSION, we do have\Drupal\Composer\Composer::drupalVersionBranch(), which serves a similar purpose.Comment #37
mile23Updated to use
\Drupal\Composer\Composer::drupalVersionBranch()cuz that's the perfect thing.Included here are patches for 8.8.x, 8.9.x, and 9.0.x. Committers can use whichever ones they please, and ask for more as needed. :-) This issue is still targeted for 8.9.x, however.
Interdiff reflects a bad rebase that was fixed along with the change.
Comment #38
jibranThank you for addressing the feedback @Mile23.
I'd give committer a choice at the time of commit rather than wait for them to come back to the rerolled patch. But I'd not set a patch to NW if there is no 8.8 patch :)
Comment #39
greg.1.anderson commentedLooked over #37. +1 on RTBC.
Comment #40
Mixologicif this lands #3086489: Exclude development libraries from templates' composer.json by default this will need a reroll
Comment #41
greg.1.anderson commentedThis needs an update because we have a new path repository that needs to be added to the list of path repos in the tests.
Comment #42
greg.1.anderson commentedI was aiming at "Needs work", but missed.
Comment #43
mile23Reroll after #3087482: Add 'next steps' info to Composer installation output
Comment #45
greg.1.anderson commentedIs "prefer-stable" interfering with our path repository in #43, maybe?
Comment #46
greg.1.anderson commentedThe failure in the 8.8.x branch would also happen on the other branches, I think, if there were any tagged versions (just as 8.8.x has one version tag, 8.8.0-alpha1), so we shouldn't commit this to any branch until we have that problem resolved.
Comment #47
MixologicYeah, its the issue where 'need a way to get the exact version of core from the template' problem, yet also have an upgrade path. Hence why the 8.8.x test is getting 8.8.0-alpha1 everywhere.
Comment #48
greg.1.anderson commentedThat makes sense. So we're blocked here until we can put the composer.lock into the template projects, then.
Comment #49
mile23Uhm, nope. :-)
Which leads us to a seemingly-eternal question...
Why does drupal/core-composer-scaffold resolve to 8.8.x-dev but the others do not?
drupal/core-composer-scaffold has a branch-alias setting, but adding a similar branch alias to the other packages does not solve the problem.
The answer seems to be: The patch in #43 does not account for the project message plugin as a path repo. Therefore Composer searches the world for a version and discovers 8.8.0-alpha1, and then that apparently opens the floodgates and all bets are off when it comes to the rest of our carefully-curated path repos. Whether this counts as an upstream bug or not probably depends on your point of view.
So that leaves us with a choice for this test:
1. Hard code all our expectations for where plugins and metapackages should be, so that they can be converted to path repos.
2. Dynamically generate all the path repos by scanning the file system for the various packages.
This patch does the latter, and the reason is this: As we add metapackages or plugins and/or modify the templates, we should gracefully make sure that the patched additions are available to this build test. Using hard-coded paths means that we could get false positives because no one would remember to update this test.
This patch also adds a test which reconciles the template dataprovider against a scan of the composer/Template directory to fail and tell us that we need to update this test for templates when we add them.
Comment #50
greg.1.anderson commentedThanks for dynamically discovering the path repositories we need. I think that's a good idea.
Comment #51
mile23This patch fixes the bad rebase for the 8.8.x patch from #49.
Comment #52
mile23Hiding files.
Comment #53
MixologicSo I've been stepping through this with the debugger, and got to the part where the test executes something like this:
1.
COMPOSER_CORE_VERSION=8.8.x-dev composer create-project drupal/recommended-project testproject 8.8.x-dev -s dev -vv --repository core/tests/Drupal/BuildTests/Composer/fixtures/packages.jsondrupal/recommended-project has
Which, to me means that as soon as we have an 8.8.0 stable release, the 8.9.x-dev branch is going to start failing because it will find a stable version.
2
We're not making a path repository for /core, and its pulling drupal/core from github, which, due to a bug in the subtree splitter, happens to be 2 days behind because it breaks when a tag is pushed atm. (which is how I noticed that the latest commit in the repo is only getting things from nov 5, instead of whats being tested locally)
3
This test assumes that every plugin we put into /composer/Plugin is something we'll want to include pathrepo wise for the tests -> I think thats going to be okay, even if the requirements between the tests are different - i..e no real harm in Recommended-Project getting a path repo for the vendorHardening plugin.
4
I made a change to core-recommended, added a new dependency and looked at the output and confirmed that the new dependency that I had added was in the output.
5
So I guess my only remaining question is what are some circumstances that would lead this test to fail? What kinds of changes would go into a patch that would break the templates, and can we emulate that somehow and prove that it catches that? maybe add a conflicting dependency to the metapackages or something... not sure.
Man. Build tests are sweet.
Comment #54
mile23#1: "Which, to me means that as soon as we have an 8.8.0 stable release, the 8.9.x-dev branch is going to start failing because it will find a stable version." I don't think that's the case since there's a path repo, but I'm totally willing to be wrong. If the build tests were in 8.7.x we could test that now.
#2: We should add drupal/core as one of the path repos.
#3: We add all the possible path repos because the test doesn't know which ones are required by the current template. This way it works for whichever template you supply in the @dataprovider.
#5: I think you're right that this test is the round-trip for the metapackages: You do a dev on core, you update composer.lock, it generates new metapackages, that's all in the patch, and here we apply those metapackages back in a build process. Theoretically this should never fail because you were able to generate a composer.lock file in the first place, but if it does, we want to know.
The other thing is that we've already used the tests to find a 'bug' in the template files in #33. I put bug in quotes because if you're making a new project, you'd probably get what you wanted, but per-branch it breaks our expectation.
The cherry on top would be to perform an install and visit the front page, but this thing already takes two and a half minutes. Also, i'm not sure the quickstart feature knows what to do with the recommended install layout. That'd make a good follow-up.
Comment #55
mile23This patch adds drupal/core as a path repo, with added assertions to match.
There’s also a FAIL patch which illustrates some ways to fail this test by making a bad project template. One has minimum_stability at stable, and the other specifies a scaffold file that doesn’t exist.
Comment #57
greg.1.anderson commentedAre we still sure, though, that this test won't pull stable tags from Packagist, once they exist?
To avoid that for certain, we could set
composer config -g repo.packagist false; then we would know that our tests would never pull from packagist. At the moment, the only package we deliberately use from packagist is composer/installers. I think we could define composer/installers in our packages.json file, and point it at packagist. While I think that works, I have not tried, so I am not sure that I am right. I'd feel better about these tests if we turned off packagist, though.Comment #58
greg.1.anderson commentedExperimenting with #57.
Comment #59
greg.1.anderson commentedOK, #57 is not going to make things more stable for us. There are a lot of packages we'd have to put in our packages.json file, and as the drupal/core composer.json evolved, our fixture would become out of date. This solution would therefore probably cause more problems than it solved.
Comment #60
mile23Yes, if we turn off packagist (and/or drupal composer facade) then we can only get cached discoveries. Also, we'd have to turn it back on in tearDown() because otherwise the next test will break.
Comment #61
greg.1.anderson commentedOK, I believe that #55 is going to continue to work even when there are stable tags of drupal/core-recommended et. al.
What I did:
The same should be true of our other path repositories. Interdiff of my test changes included.
Comment #62
mile23I was trying to figure out how to make a fake D8.8 release and stuff, but the drush/drush experiment in #61 is the right idea. However it doesn't actually pass, since the test doesn't make path repos for the Template directory.
Here's a patch that demonstrates this technique that should pass DrupalCI by moving the fake drush/drush into composer/Plugin/.
Comment #63
mile23#62 is the interdiff. :-)
Edit: The fail just tells us that the fake drush/drush composer.json file doesn't validate, so yay, we demonstrated that path repos work.
Comment #65
mile23Will re-upload #55 after #3090906: self.version in metapackages considered harmful, which is a bugfix and might make a reroll happen here.
Comment #66
MixologicSee https://www.drupal.org/project/drupal/issues/3095967#comment-13362548
Theres a couple of comments about d9 that we could add to the patch in #55
Comment #67
alexpottHere's a patch with the comments fixed for D9. Imo we shouldn't block this on the other patch. If that one needs rerolls so be it.
Uplaoding the 8.8.x patch again to so the most recent patches are the correct patches.
Comment #68
MixologicHere's the 8.9.x patch from #55 as well
Comment #69
mile23Yes, each branch needs its own patch, because they have to target their own core version per #33.
Leaving the backport tag until we get a commit to 8.8.x. I'm not entirely sure which branch has the code freeze at this point...
And here's the follow-up: #3096044: Ensure quickstart feature works with drupal/core-recommended
Comment #70
alexpott@Mile23 are you sure that we need to adjust the version for each minor release? @greg.1.anderson said that we wouldn't need to do this. If we do then we're going to need to automate this so release managers don't have to think about this. I think once we remove
"minimum-stability": "dev",we shouldn't need to update the minor release and everything will work the way we want it to. #33 does not contain any justification for why we need the 8.9 specific version as far as I can see.Comment #71
MixologicYeah, on second thought, ^8.8 is fine for the 8.9 branch because you would get the most latest version of the dependencies.
I concur with #70
Comment #72
MixologicAlso, the other situation is that we're adding lockfiles to the templates such that they should start with their exact version of all of their deps.
Comment #73
greg.1.anderson commentedI commented on this issue this morning, but don't know what happened to it. Didn't get saved, apparently.
Yes, if you put
^8.9in a template project, it's just documentation. We might as well stick with^8.8for the d8 branches and^9for the d9 branches. We could even consider using^8.7for the d8 branches, because we have metapackage tags for all of the old Drupal 8 releases.As far as minimum-stability is concerned, you still need "dev" for dev releases, because drupal/core-recommended requires drupal/core, and that won't work without minimum-stability "dev" if core-recommended is being required at a dev version. We can fix the minimum stability up as part of the split tree process for stable tags. We should keep it "dev" in the drupal/drupal repository.
Comment #74
mile23Well, except it's not, actually. Because, as I pointed out in #33, for the 9.0.x branch Composer can resolve drupal/core-recommended to 8.8.0-alpha1 because it's more stable than 9.0.x-dev, which undoes the purpose of the test. See #10.
@alexpott mentions that if we get rid of
minimum-stability: devthen that's not the case. But we haven't done that, and I don't see an issue to do that. Also, I don't think that we should, because then we can't require any dependencies at @dev stability. If you look at 9.0.x you see that we're using a beta version of symfony because we have to (for now).And even if we get rid of
minimum-stability: dev, then we'd still be allowing drupal/core-recommended:8.8.0 within the 9.0.x branch, which doesn't make much sense at all, especially in light of this issue: #3090905: composer create project drupal/core-recommended:version should get the exact version specified For instance, if you are running PHP 7.0, and you saycomposer create-project drupal/recommended-project myproject ~9then you'll end up with the 9.0.x version of the template, and either 8.8.x or 8.9.x version of core, with no indication of this mismatch. What should happen is that Composer should say, no, you can't install Drupal 9 on PHP 7.0.I can understand the desire to not have to update the templates with appropriate minor versions with each release in this test, but we have to do that for the packages.json file even if we don't do it for the templates. Otherwise we're not testing whether we can build with the patched codebase. Also, the test won't have false positives if we overlook that update. It will fail because we do this:
The proof is https://www.drupal.org/pift-ci-job/1482558, which is the failed test against 3086644_88x_55.patch in #67, that ran against 8.9.x instead of 8.8.x.
If anyone wants to amend the patch to improve it, that'd be great.
But if we're changing specifications such that we're *not* testing whether we can build against the patched codebase, then someone will have to update the issue summary to reflect this fact.
Comment #75
alexpott@Mile23 re
I think the constraint in the major branch needs to match but I hope we don't need to do minor updates. There's no way that 8.8.0-alpha1 can match ^9
Here's a patch for 8.8.x the passes on 8.9.x as well. Plus updated the 9.0.x patch to work the same way.
Comment #76
mile23Well, it's the same problem moving forward: 9.0.0-alpha1 can match ^9 when you mean ^9.1 with minimum-stability:dev. This is much less likely than the 8-for-9 mixup, but only by accident.
But it's still a thing. We want this test to fail if that happens, so that release managers can be sure they're getting what they want.
+1 on this change, except it means the doc block is incorrect now.
Comment #77
mile23Now that we have an official release for 8.8.0 I was able to run this against a tagged release with good effect.
This fails (as it should) because drupal/core-recommended still requires drupal/core 8.8.0, so the build log does not reflect 8.8.x-dev. Like this:
Without modifying \Drupal::VERSION we get a pass. So yay!
This patch updates the docblock mentioned in #76.
Comment #78
mile23Patch still applies. Re-testing.
Comment #79
greg.1.anderson commentedThis looks really good - great improvement over the existing shell script. Just one more suggestion:
It would be better to pass this list in from the data provider rather than calculate it from the fixture. If this erroneously came out empty, for example, then no 'Installing $package_name' assertions would run, and you could potentially get a false pass. It's easier to see that the test is valid if it is asserting based on hardcoded expectations rather than calculated expectations.
Comment #80
mile23The point of this test is to account for a build from patched core, and we can patch the dependencies of any of our plugins.
For instance if the patch adds a new Composer plugin and adds a dependency to it from a template, we'd want that to be symlinked in this build. The only way to find out about it is either to dynamically generate it, or remember to amend the dataprovider here.
If we neglect to update the dataprovider, then we run into the world of false positives, where for instance the patch changes a template to require one of our existing plugins, but erroneously requires a tagged release. Then we don't know that the patched plugin is not being used.
If there wasn't a risk of false-positive, then it could be reasonable to just let the test fail and cause people to grumble as they update the dataprovider in the next patch. But they might never find out.
Comment #81
greg.1.anderson commentedTo be clear, the only bit of the calculated code I am proposing moving to the data provider is the "require" line. If someone makes a patch that adds a requirement to the Composer Template project, they'll get a false positive until they update the test, but that is as it should be, IMO.
This test will catch any other sorts of failures, e.g. if someone makes a change that isn't in the Composer Template project directly, but is somehow incompatible. That is the important coverage to get, and should not be impacted by having the `require` list in the data provider.
Comment #82
mile23Yes, that's the part where we gather the expectations from the part of the codebase that could have been patched. That's the part I'm defending. :-)
No, they'll never update the test because it's a false positive. They won't know they need to update it, because it passes.
Comment #83
greg.1.anderson commentedForgive me for inverting the positive / negative here.
With that orientation of positive / negative, I don't think you ever get a false positive, as you're always looking for evidence that the requirements were installed in the command output. Ah, but I see that you are also concerned that there should be a test for the new requirement, which won't be tested if not explicitly added. Perhaps you should both add the list of requirements to the data provider, and also confirm that it matches the requirements in the code.
If you leave the `requires` calculation in code only, you could get a false positive e.g. if the list of requirements erroneously comes back empty.
Comment #84
mile23OK, so the concern is that there's a false positive if there is some sort of error about the template requirements, not necessarily that the expectations are or aren't hard-coded.
We already have some assertions about the existence of the composer.json file, which helps in that regard.
Adding hard-coded expectations is definitely desirable, but see #70.
So adding hard-coded expectations and then checking up on them means we're not only testing the code but also testing the test. We do that a little bit here with
testVerifyTemplateTestProviderIsAccurate()which checks if there are new templates we haven't accounted for here, because it seems likely we'd do that at some point.I think in the case of
$require, however, if we trust a separate process that checks the hard-coded test data, then we should cut out the middle man and have the trusted checking data be the test data. We can put a boundary check on it, such as asserting that$requireis not empty because it's vanishingly unlikely that we'd have a template with no requirements.Here's a patch which does just that.
Comment #85
greg.1.anderson commentedI would have preferred we add the requirements to the test data, and handle confirming its correctness exactly like
testVerifyTemplateTestProviderIsAccurate(). I don't think that #70 is a concern, as the requirements of the template projects do not change often, and they do not change as part of the release process e.g. for going to a new minor release.However, I'll accept the compromise in #84 on the assumption that it is really unlikely that we could have a defect that calculated an incorrect but non-empty
requireslist that also passed all of the assertions that follow against the command stdout having the right requirement messages.Let's get this in so that we can start to benefit from the better tests.
Comment #86
mile23Now that Drupal 9 requires PHP 7.3+, I added that test to the 9.0.x patch in #84.
Comment #87
hestenetComment #88
MixologicSo, this issue fixes the templates and keeps them sane, and has been RTBC for quite some time now. Turns out we cant release 9.x until we have some composer templates that can actually, use 9.x.
So, either this is blocking alpha1, or we need to corral off an smaller sub issue (reopen https://www.drupal.org/project/drupal/issues/3095967)
Comment #89
greg.1.anderson commentedMerging here is the better option; #3095967: Update project templates for Drupal 9 would need work to get it caught up to what is already here, and the test improvements in this patch are useful.
Comment #90
MixologicI agree with #89 but can imagine a possibility of somebody wanting to split a 100% hard blocker for alpha1. Granted, having the test would prevent it from even being a blocker so...
Comment #91
mile23This should have been committed before 8.8.1, because basically the raison d'etre of the composer initiative is untested. That's despite having all these subtree splits in the repo specifically so that we can test them patched in DrupalCI, and despite having invented a new testing framework to accomplish it.
It should be a hard blocker for 9.0.x-alpha1.
Comment #92
catchTo solve the split or not discussion what about this re-title?
One comment nit, but did not do a very in-depth review yet.
Minor nit but it'd be better to say 'Assert that the template name is in the project created from the template' or something else without a question mark.
Comment #93
Mixologic+1 on #92 also, just making it clear that its completely 100% impossible to create the alpha1 release tag without the template changes.
Comment #95
catchOK fixed the comment on commit. Committed 5139354 and pushed to 9.0.x. Thanks!
This will need a re-roll for 8.9.x and 8.8.x.
Comment #96
catchMore of a 'needs work' for the re-roll.
Comment #97
mile23The 8.9.x/8.8.x patch from #84 still applies, but here it is again.
Comment #98
greg.1.anderson commentedThis has been committed to 9.x, and the patches in #97 contain only backported tests that will make 8.9.x and 8.8.x development better. This is therefore safe to commit to both branches.
Comment #101
xjmCommitted the backport to 8.9.x and 8.8.x. Thanks!