Problem/Motivation
There are several Migration Kernel test files that run setup twice but do not need to. The only difference in the tests are the assertions run after the migration. There is no need to do the setup more than once. The migration can be run once and then all the assertions
This was already done in #3165763: Combine two tests to one in d7 MigrateFieldTest and MigrateFieldInstance. This issue does the same for the other migration tests, of which there are 10.
Also, an annoyance factor when working with those tests.
Proposed resolution
Combine the assertions
Remaining tasks
Patch
Review
Commit
Comment | File | Size | Author |
---|
Issue fork drupal-3192900
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3192900-combine-some-migration changes, plain diff MR !277
Comments
Comment #2
quietone CreditAttribution: quietone as a volunteer commentedAssuming this passes test, the review here is straightforward and suitable for a novice.
Comment #3
quietone CreditAttribution: quietone as a volunteer commentedAs soon as I uploaded I realized I hadn't run commit-code-check.
Comment #4
quietone CreditAttribution: quietone as a volunteer commentedComment #7
MatroskeenThe patch needed a re-roll after #2867959: Replace usages of deprecated AssertLegacyTrait::assertIdentical, so I created a merge request based on patch #3.
I prepared some numbers to see why these changes are good:
core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentTest.php
Before the patch: 1.12 minutes
After: 33.21 seconds
core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserTest.php
Before the patch: 59.59 seconds
After: 34.75 seconds
I reviewed other similar migrations and I think it might be possible to optimize at least some of these:
core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeComplete.php
core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentSettingsTest.php
core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserPictureD6FileTest.php
Moving to NW for that.
Comment #8
MatroskeenComment #9
quietone CreditAttribution: quietone as a volunteer commentedThanks for putting some numbers on this. It is nice to see the improvement.
I am not surprised there are more. I count 31 migrate kernel tests with more that one test method.
Comment #10
quietone CreditAttribution: quietone as a volunteer commentedComment #11
MatroskeenLooks good to me, thanks!
Comment #12
quietone CreditAttribution: quietone as a volunteer commentedYour welcome.
Comment #13
alexpottCommitted 82c63a2 and pushed to 9.2.x. Thanks!