Postponed on: #2937655: Fix entity type mapping in field migrations.

Problem/Motivation

We've found a couple cases now where the integration between migrations is causing issues. See #2899062: Order migration does not list store migration as dependency and #2899149: Product display migration is missing dependency on d7_product_display_type as a couple examples.

Proposed resolution

Let's add a test of all the things to help us catch some of these things. Modeled after the UI test in Drupal core.

Remaining tasks

Code it.
Review it.

User interface changes

n/a

API changes

n/a

Data model changes

n/a

Comments

heddn created an issue. See original summary.

heddn’s picture

quietone’s picture

Let's wait until #2569805: For Drupal migration, identify the source module is in to do this. Otherwise, I'm pretty sure the destinations won't be correct and we can avoid some rerolling.

Once that is in, a ProvidersExist test can be added too, to make sure that the migration have a source_module and destination_module declared.

quietone’s picture

So, what I think needs to happen is

  1. #2569805: For Drupal migration, identify the source module gets committed
  2. Add source_module and destination_module to the migrations/source plugin/destination plugins as needed
  3. Write a ProvidersExist test, which wiil test the previous step
  4. Write this migration test for this issue.
quietone’s picture

quietone’s picture

Status: Active » Needs review
StatusFileSize
new2.17 KB

Let's get this going. This is a rough start, haven't looked at the entity counts yet.

Fails locally, but it is a start.

Status: Needs review » Needs work

The last submitted patch, 9: 2899672-9.patch, failed testing. View results

quietone’s picture

I wanted to test a migration using the UI and the commerce kickstart demo site. And see what happends

There were no fatals.
There were 8 1/4 pages of errors from migrate_drupal_ui. Many about missing files, which I did not migrate.
Sample of errors;
Source ID commerce_customer_address,commerce_customer_profile: The "commerce_customer_profile" entity type does not exist. (/opt/sites/d8/core/lib/Drupal/Core/Entity/EntityTypeManager.php:133)
That is interesting, what needs to happen for the commerce_customer_profile to exist.

Attempt to create a field storage commerce_total with no type. (/opt/sites/d8/core/modules/field/src/Entity/FieldStorageConfig.php:252)
And for other fields as well.

And the expected entity type doesn't exists for commerce_discount
Product variations are migrated but the product id is NULL.
Products were not migrated.
Configuration (currency, store, product and product variation type) appears correct

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new12.58 KB

A new start.

Status: Needs review » Needs work

The last submitted patch, 12: 2899672-12.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new12.52 KB

This is the patch I meant to upload.

Status: Needs review » Needs work

The last submitted patch, 14: 2899672-13.patch, failed testing. View results

quietone’s picture

StatusFileSize
new12.52 KB

Copy/paste errors strike again. This was loading commerce_migrate_ubercart and the ubercart fixture. Yikes!

quietone’s picture

Status: Needs work » Needs review

Setting to NR for testbot.

Status: Needs review » Needs work

The last submitted patch, 16: 2899672-16.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new6.08 MB
new7.84 KB
new11.79 KB

This needs the files, which unfortunately are quite a few and make this a large patch and because of that there is a review only patch that doesn't have the files. The interdiff was made against the review only patch, so it too doesn't have the files. The patch has updates for the entity counts and because #2916199: MigrateUpgradeTestBase shouldn't enable modules and #2914974: Migrate UI - handle sources that do not need an upgrade were committed this test can now extend from MigrateUpgradeTestBase, which meant several methods can be deleted.

This won't pass all tests yet.

Status: Needs review » Needs work

The last submitted patch, 19: 2899672-19.patch, failed testing. View results

quietone’s picture

There is a failure in d7_commerce_payment_transaction somewhere. Made a fresh install, configured the migrations and d7_commerce_payment_transaction and received the error, Migration not found.

quietone’s picture

Issue summary: View changes
Status: Needs work » Postponed
quietone’s picture

Locally I removed the payment migration and ran the test again. It now reports a failure in d7_field_instance migration.

1) Drupal\Tests\commerce_migrate_commerce\Functional\d7\MigrateUpgradeCommerce1Test::testMigrateUpgrade
Migration of a:3:{s:9:"sourceid1";s:15:"product_display";s:9:"sourceid2";s:5:"shoes";s:9:"sourceid3";s:14:"field_category";} to a:3:{s:11:"entity_type";s:16:"commerce_product";s:6:"bundle";s:5:"shoes";s:10:"field_name";s:14:"field_category";} as part of the d7_field_instance migration. The source row status is 3

/opt/sites/d8/modules/contrib/commerce_migrate/modules/commerce/tests/src/Functional/d7/MigrateUpgradeCommerce1Test.php:153

This could be a dependency problem. Running this migration via drush works if the required and optional dependencies run first but --execute-dependencies is not running the optional migrations. I was using 9.0.0-beta4.

quietone’s picture

Status: Postponed » Needs work

The d7_commerce_payment_transaction migration and associated source plugin have been reverted, so this can proceed.

quietone’s picture

Issue summary: View changes

Retesting and remove the postponed notice from the IS

quietone’s picture

Today I am getting errors in d7_field.

 [error]  'field_storage_config' entity with ID 'commerce_product.field_brand' already exists. (/opt/sites/d8/core/lib/Drupal/Core/Entity/EntityStorageBase.php:425) 
 [error]  'field_storage_config' entity with ID 'commerce_product.field_category' already exists. (/opt/sites/d8/core/lib/Drupal/Core/Entity/EntityStorageBase.php:425) 
 [error]  'field_storage_config' entity with ID 'commerce_product.field_collection' already exists. (/opt/sites/d8/core/lib/Drupal/Core/Entity/EntityStorageBase.php:425) 
 [error]  'field_storage_config' entity with ID 'commerce_product.field_gender' already exists. (/opt/sites/d8/core/lib/Drupal/Core/Entity/EntityStorageBase.php:425) 
 [error]  'field_storage_config' entity with ID 'commerce_product.field_product' already exists. (/opt/sites/d8/core/lib/Drupal/Core/Entity/EntityStorageBase.php:425) 

I'm going to step away from this problem for a while, feels like I am going down a rabbit hole with no end.

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new6.1 MB

This is a test only patch. It includes #2937655: Fix entity type mapping in field migrations and the necessary changes to the entity counts. Let's see what errors are found.

Status: Needs review » Needs work

The last submitted patch, 27: 2899672-27.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new72.83 KB

Again this is a test only patch. This include the patch from #2937655: Fix entity type mapping in field migrations, comment #9.

Status: Needs review » Needs work

The last submitted patch, 29: 2899672-29.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new6.11 MB

Forgot the --binary option.

quietone’s picture

Sweet!

quietone’s picture

Issue summary: View changes
Status: Needs review » Postponed
StatusFileSize
new7.84 KB
new6.08 MB

Here is the patch, without the fields patch, which this is now postponed on #2937655: Fix entity type mapping in field migrations.

heddn’s picture

Status: Postponed » Needs work
quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new7.64 KB
new6.08 MB

Rerolled but not passing test locally, it runs the whole migration before failing with no useful messages and the debugger is playing up again. Let's see what testbot has to say.

quietone’s picture

Well, it must be something local.

heddn’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

The last submitted patch, 33: 2899672-33.patch, failed testing. View results

  • heddn committed 3f39b6d on 8.x-2.x authored by quietone
    Issue #2899672 by quietone, heddn: Commerce 1 Test "All The Things"
    
heddn’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.