Problem/Motivation
Found on https://git.drupalcode.org/project/drupal/-/jobs/2356950
core/modules/field/migrations/d6_field_formatter_settings.yml depends on Drupal\migrate_drupal\Plugin\migrate\FieldMigration
For some reason this isn't picked up by the test when it runs locally via phpunit, or when it runs on HEAD, but it is picked up by that MR and it looks like a real bug - the plugin class is provided by migrate_drupal but the migration is defined in migrate.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3466289
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:
Comments
Comment #2
catchGetting the test to only create the migration instance it actually needs still passes locally. Given we're deprecating migrate_drupal altogether for removal in Drupal 12, this might be as far as we want to take this - the bug has been hidden for years.
Comment #4
quietone commentedWhat is the relation between the test and d6_field_formatter_settings.yml? It should not be involved in this test at all. Without migrate_drupal installed only the migration provided by the test should be discovered.
Comment #5
catchThe test installs node, which depends on text, which depends on field module, which provides this migration.
This is the backtrace from the test:
https://project.pages.drupalcode.org/-/drupal/-/jobs/2356950/artifacts/s...
The call to getInstances('') discovers and creates a plugin instance for every migration.
What in MigratePluginManager is supposed to stop the migration from being discovered?
Comment #7
benjifisherI think @catch is 100% right. It has always worked this way, it creates other problems, and it is kind of crazy: we instantiate every migration plugin way too often.
In migration projects, I implement
hook_migration_plugins_alter()to filter out all the D6 migrations.A Nightwatch test failed. After 10 minutes, I cannot figure out how to trigger a re-test (grr). So I rebased and force-pushed.
Comment #8
smustgrave commentedif the MR is opened by a core committer even getting push access you can't re-run tests, super inconvenient!
Comment #9
catchNightwatch was probably #3471104: Nightwatch and Functional JavaScript fails since selenium/standalone-chrome:128 but also we get regular enough random fails on nightwatch anyway.
Comment #10
smustgrave commentedChange seems small enough though and tests are all green.
Comment #11
quietone commented#4 Ah, of course. I was clearly not thinking.
Comment #16
quietone commentedCommitted and pushed to 11.x, 11.0.x, 10.4.x, and 10.3.x.
Thanks!
Comment #17
benjifisher+1 for the implemented fix.
The previous code instantiated all migrations, then used just the one from the test module. The fix instantiates just the one that is used.
We also could have used
createInstance()instead ofcreateInstances().It is a little odd that the migration in the test module has an ID that does not match its file name: from
node_migration_no_upgrade.yml,The
idis what matters, not the file name.