Problem/Motivation

Drupal\Tests\migrate_drupal\Kernel\d6\FieldDiscoveryTest is randomly failing on PostgreSQL. See https://www.drupal.org/pift-ci-job/1223254

1) Drupal\Tests\migrate_drupal\Kernel\d6\FieldDiscoveryTest::testGetAllFields

Failed asserting that Array &0 (
    0 => 'employee'
    1 => 'test_planet'
    2 => 'page'
    3 => 'test_page'
    4 => 'story'
) is identical to Array &0 (
    0 => 'employee'
    1 => 'test_planet'
    2 => 'page'
    3 => 'story'
    4 => 'test_page'
).

Proposed resolution

Fix it

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

N/a

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alexpott created an issue. See original summary.

alexpott’s picture

Issue summary: View changes
alexpott’s picture

Adding order to duplicate default MySQL order based on key.

andypost’s picture

Closed as duplicate #3038899: Fix postgresql tests after 2951550

+++ b/core/modules/migrate_drupal/tests/src/Kernel/d6/FieldDiscoveryTest.php
@@ -270,7 +270,9 @@ public function testGetAllFields() {
+    $this->assertSame(sort($expected_keys), sort($actual_keys));

+++ b/core/modules/migrate_drupal/tests/src/Kernel/d7/FieldDiscoveryTest.php
@@ -268,7 +268,9 @@ public function addAllFieldProcessesAltersData() {
+    $this->assertSame(sort($expected_keys), sort($actual_keys));

I bet on Alex fix - because migrations use iterators and ordering for pgsql is unexpected, at least no reason to sort expected array cos you define it one line above

quietone’s picture

Sorry, 'twas an accident to upload my solution, the fix from alexpott is better.

andypost’s picture

Status: Needs review » Reviewed & tested by the community

Let's go this way

mikelutz’s picture

I support this approach, if we can force things to come back in the same order every time, we certainly should. +1 RTBC as a Migrate Maintainer.

  • larowlan committed 6896b4e on 8.8.x
    Issue #3038892 by alexpott, quietone: Drupal\Tests\migrate_drupal\Kernel...

  • larowlan committed c09f7d1 on 8.7.x
    Issue #3038892 by alexpott, quietone: Drupal\Tests\migrate_drupal\Kernel...
larowlan’s picture

Status: Reviewed & tested by the community » Fixed

Committed 6896b4e and pushed to 8.8.x. Thanks!
C/p as c09f7d10cf and pushed to 8.7.x

Status: Fixed » Closed (fixed)

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