Problem/Motivation
Spin-off from #3087644: Remove Drupal 8 updates up to and including 88**.
Once we've removed older Drupal 8 updates from Drupal 9, it will be necessary for all new updates added to the code base to be tested from a Drupal 8.8.x starting point, since Drupal 9 won't be able to run updates from 8.7.x or earlier databases any more.
Our Drupal 8 test coverage is reliant on database dumps, but we did recently add #3031379: Add a new test type to do real update testing which provides an alternative way to test updates - by installing Drupal then updating the install instead of loading a database dump.
Whichever we use, we need boilerplate test coverage for running updates. Something like the following for basic test coverage:
- both minimal and standard install profiles. (and standard+).
- The source site/database needs to have content created in it (nodes, taxonomy terms, users) so that there's actually something to update in there.
Marking critical because it is going to block either the Drupal 9 beta, or adding new upgrade paths to Drupal 8, depending on whether this issue or the update removal one happens first. Also if we add new updates to 8.8.x using our old testing harness, we'll need to refactor the test coverage for them anyway, so really it should block new updates either way.
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
New database dumps have been added for upgrade path testing from 8.8.x onwards. This is in preparation from updates prior to Drupal 8.8.0 being removed from Drupal 9.
Comment | File | Size | Author |
---|---|---|---|
#42 | 3089900-42.patch | 714.32 KB | jibran |
Comments
Comment #2
catchComment #3
alexpottSo we could theoretically install umami on 8.8.x and update it to Drupal 9 and run its tests - that'd give us multilingual content to test against. But OTOH we said we'd never support umami upgrades and reserve the right to break things. So maybe we could install umami, change the theme to another theme, hack the profile.... ugh.. I dunno maybe that'd work.
Comment #4
catchProbably the quickest way to get an 8.8 database dump would be to install the existing test database dumps, update them to 8.8.x, then redump. I don't think we should keep doing that forever, but one advantage is it does give us an example of a database with a long lifespan.
Comment #5
jibran@catch
- 8.8: This makes sense. I think we can write a test to do that for us and it will generate the new DB dump at the end.
- 8.9: Are we going to use above D8.8 DB dumps for this branch as well? Do we want to do that for all the dumps in the code atm?
- 9.0: In #3087644: Remove Drupal 8 updates up to and including 88**, I'm adding a new D9 DB dump to make sure upgrade path tests keep working in D9. We can bring those parts over here unless we want to keep those there and forward port the D8.8 dumps to D9?
Comment #6
catch@jibran I think it's worth having both 8.8 and 9.0 database dumps tested against 9.x - for example an 8.8 database dump might have a reference to something that's going to be removed in 9.x that we haven't accounted for. So for me I would move those over here (should also mean less to review in the removal patch).
Comment #7
jibranGoing to have a crack at this.
Comment #8
jibranWe have following DB dumps.
After discussing with @larowlan in going to create following dumps
8.8.0.bare.standard
,8.8.0.filled.standard
,8.8.0.bare.testing
,8.8.0.bare.minimal-with-warm-caches
Please let me know if we that is enough or not enough.
Comment #9
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedI don't think
8.8.0.bare.minimal-with-warm-caches
(or any dump with warm caches for that matter) is relevant anymore after #3055443: Switch to a null backend for all caches for running the database updates.Comment #10
jibranThanks, I'll remove it.
Comment #11
jibranHere is the patch which adds three more DB dumps
8.8.0.bare.standard
,8.8.0.filled.standard
, and8.8.0.bare.testing
after running updates on exiting ones.I hacked
\Drupal\FunctionalTests\Update\UpdatePathTestBaseTest
and\Drupal\Tests\system\Functional\Update\UpdatePathTestBaseFilledTest
to use newcore/modules/system/tests/fixtures/update/drupal-8.8.0.bare.standard.php.gz
andcore/modules/system/tests/fixtures/update/drupal-8.8.0.bare.standard.php.gz
and they are passing now. Should we add new 8.8 only tests?I have also added
core/modules/system/tests/fixtures/update/drupal-8.8.0.bare.testing.php.gz
but I'm not sure what type of test is best suited for this.Do not test patch is contains all the code changes.
Also, uploading
update-db-dump.txt
which I used to generate the new dumps for the old dump.Comment #13
jibranLeft the existing tests alone and copied them to new one also added test for testing db dump.
Comment #15
catchHEAD was broken.
Comment #16
catch#13 looks like a good start to me.
I'm not sure we can add a lot more coverage here because we have no specific updates to test yet, but we're bound to have a config update or similar to commit for 8.9.x soon, so I think it would make sense to start adding test coverage against these new databases instead of the old ones, to reduce conflicts with 9.x once we remove the old dumps.
This is for an older version update so it should never be possible to run into any more, but on the other hand it's test coverage for a hypothetical future problem with router entries so might as well leave it in?
Comment #17
jibranWe are checking bare minimum here in my opinion which should be fine for the scope of this issue.
Given that #3087644: Remove Drupal 8 updates up to and including 88** is going to remove the old tests I'd say let's keep it.
Is anything left here to address?
Comment #18
catchI don't think so, let's try to get some more reviews.
Comment #19
alexpottI think it is okay to change the dumps that
core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBaseTest.php
andcore/modules/system/tests/src/Functional/Update/UpdatePathTestBaseFilledTest.php
use so we don't have to delete them in 9.0.x.These tests test update functionality not the dumps or specific updates.
Also I don't understand why the patch is adding both
core/modules/system/tests/src/Functional/Update/UpdatePathTestBase88BareTest.php
andcore/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase88Test.php
- ah I guess this is to test bothcore/modules/system/tests/fixtures/update/drupal-8.8.0.bare.testing.php.gz
andcore/modules/system/tests/fixtures/update/drupal-8.8.0.bare.standard.php.gz
. I think we shouldn't addcore/modules/system/tests/fixtures/update/drupal-8.8.0.bare.testing.php.gz
here. We've only used 4 times since it was added. I think testing updates with as many modules and other updates happening is a good thing. Side effects and unexpected results here are common (unfortunately).Comment #20
alexpottWhat I'm trying to say in #19 is that we should change \Drupal\FunctionalTests\Update\UpdatePathTestBaseTest and \Drupal\Tests\system\Functional\Update\UpdatePathTestBaseFilledTest to use the new 8.8 dumps rather than duplicating them.
Comment #21
jibranAddressed #19 and #20.
Comment #23
jibranWe don't need
core/modules/system/tests/src/Functional/Update/UpdateSchemaTest.php
anymore.Comment #24
alexpottHere's the smallest possible change here. Which is what I think we want in order to preserve BC. So this patch does not change the user 1 account of the filled db. It also doesn't unnecessarily change the update numbers of the test module or remove any other tests.
Comment #25
alexpottI've rebuilt the db dumps from the original 8.0.0 dumps because I can't explain how user 1 had their name and password by the process in #11.
My process is this:
gunzip -c core/modules/system/tests/fixtures/update/drupal-8.bare.standard.php.gz > drupal-8.bare.standard.php
mysql -e "drop database drupal8alt; create database drupal8alt;"
drush src drupal-8.bare.standard.php
drush updb -y
)php core/scripts/dump-database-d8-mysql.php > drupal-8.8.0.bare.standard.php
Comment #26
alexpottThis change to the test is useful because it proves we're starting from a 8.8.x dump.
Comment #28
alexpottAs per @amateescu we should drop the old_ tables from entity updates because they are not part of the update.
Comment #29
catchCurrent patch I agree is the smallest change, I'm wondering about this change that was dropped:
On the one hand if this was an actual core module, it should only have updates 88** and above due to convention. On the other hand our actual update API will run updates from 8001 upwards. So... I actually think we should leave that hunk out too and the current patch is good.
Comment #30
alexpott@catch yep that was my thinking too. Also if there's no change in this module and in the unlikely case some contrib or custom is using this module for very interesting update testing then at least this change won't break their testing.
Comment #31
BerdirI've created #3095333: Extend filled database dump with new stable modules and content for them as a follow-up.
Comment #32
catchOK I think this is RTBC with that follow-up opened.
Comment #33
BerdirUsing the entity API before running updates is a problem. It works now, but it will sooner or later break when we e.g. add another field to it.
It's ugly, but we should do this with raw database queries.
Comment #34
jibranWhy not a new db script instead?
Comment #35
jibranDB queries it is.
Comment #36
Berdirservice('uuid') gives you the uuid service, not a uuid ;)
This is also quite hard to understand IMHO. I don't think you need fields() at all when you provide values like this. Maybe define $values first for the shared ones, and then do $database->insert()->values($values + specific ones)->execute() twice, instead of building the queries in parallel?
Comment #37
jibranThanks, for the feedback.
\Drupal::service('uuid')
was wrong copy paste.Comment #38
jibranIgnore #37 this patch addresses #36 properly. Interdiff is from #35.
Comment #40
BerdirYeah, that's much more readable, RTBC if it passes. I didn't look into the database dumps, but @alexpott and @jibran have cross-reviewed and compared that *a lot*.
Comment #42
jibranFixed the last fails.
Comment #43
BerdirNow it passed :)
Comment #44
jibranJust for clarity. Here are two DB diffs.
git diff --no-index -- core/modules/system/tests/fixtures/update/drupal-8.bare.standard.php core/modules/system/tests/fixtures/update/drupal-8.8.0.bare.standard.php > bare-db-8-to-8.8.x.diff
git diff --binary --no-index -- core/modules/system/tests/fixtures/update/drupal-8.filled.standard.php core/modules/system/tests/fixtures/update/drupal-8.8.0.filled.standard.php > filled-db-8-to-8.8.x.diff
Comment #48
catchCommitted/pushed to 9.0.x, 8.9.x and 8.8.x, thanks!
Also tagging for both 8.8.0 and 9.9.0 release notes since this is a test harness addition that contrib can rely on too. Don't think it needs a change notice since no API has been changed or anything.
Comment #50
xjmThere's a CR for these changes at: https://www.drupal.org/node/3098322
@catch and I agreed this doesn't need to be mentioned in the release notes for D9.