Problem/Motivation

\Drupal\Tests\views\Kernel\Entity\RowEntityRenderersTest::testRevisionBaseTable() can randomly fail.

Example: https://www.drupal.org/pift-ci-job/1254930

Drupal\Tests\views\Kernel\Entity\RowEntityRenderersTest
fail: [Other] Line 0 of sites/default/files/simpletest/phpunit-1048.xml:
PHPunit Test failed to complete; Error: PHPUnit 6.5.14 by Sebastian Bergmann and contributors.

Testing Drupal\Tests\views\Kernel\Entity\RowEntityRenderersTest
..F                                                                 3 / 3 (100%)

Time: 7.68 seconds, Memory: 4.00MB

There was 1 failure:

1) Drupal\Tests\views\Kernel\Entity\RowEntityRenderersTest::testRevisionBaseTable

(...)

Failed asserting that Array &0 (
    0 => Array &1 (
        'nid' => '1'
        'uid' => '1'
    )
    1 => Array &2 (
        'nid' => '1'
        'uid' => '1'
    )
    2 => Array &3 (
        'nid' => '2'
        'uid' => '1'
    )
    3 => Array &4 (
        'nid' => '2'
        'uid' => '1'
    )
    4 => Array &5 (
        'nid' => '3'
        'uid' => '1'
    )
    5 => Array &6 (
        'nid' => '3'
        'uid' => '1'
    )
    6 => Array &7 (
        'nid' => '1'
        'uid' => '1'
    )
    7 => Array &8 (
        'nid' => '2'
        'uid' => '1'
    )
    8 => Array &9 (
        'nid' => '3'
        'uid' => '1'
    )
) is identical to Array &0 (
    0 => Array &1 (
        'nid' => '1'
        'uid' => '1'
    )
    1 => Array &2 (
        'nid' => '1'
        'uid' => '1'
    )
    2 => Array &3 (
        'nid' => '1'
        'uid' => '1'
    )
    3 => Array &4 (
        'nid' => '2'
        'uid' => '1'
    )
    4 => Array &5 (
        'nid' => '2'
        'uid' => '1'
    )
    5 => Array &6 (
        'nid' => '2'
        'uid' => '1'
    )
    6 => Array &7 (
        'nid' => '3'
        'uid' => '1'
    )
    7 => Array &8 (
        'nid' => '3'
        'uid' => '1'
    )
    8 => Array &9 (
        'nid' => '3'
        'uid' => '1'
    )
).

Proposed resolution

Add sorting by nid to the view.

Remaining tasks

None

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Krzysztof Domański created an issue. See original summary.

Krzysztof Domański’s picture

1. I added ascending sorting by nid to test_entity_row_renderers_revisions_base.

/**
 * Tests the row renderer with a revision base table.
 */
public function testRevisionBaseTable() {
  $view = Views::getView('test_entity_row_renderers_revisions_base');
  $view->execute();
  $this->assertIdenticalResultset($view, $this->ids, ['nid' => 'nid', 'uid' => 'uid']);
}

2. Test only with descending sorting to make sure that sorting works.

3. I do not add additional sorting by uid because it is always equal to 1.

4. Related issue #3046571: \Drupal\Tests\user\Kernel\Views\HandlerFilterCurrentUserTest:: testFilterCurrentUserAsAnonymous() can randomly fail

The last submitted patch, 2: 3046697-2-test-only.patch, failed testing. View results

dagmar’s picture

Status: Needs review » Reviewed & tested by the community

Yes, I saw this failing in other issues as well like #1886018: Make it possible to configure exposed filter operators.

The patch makes sense, the view should be sorted in some way, currently the sorting is unspecified and therefore we see this failing sometimes even when results are the same (but sorted in different ways).

Thanks @Krzysztof Domański

  • catch committed 00398c7 on 8.8.x
    Issue #3046697 by Krzysztof Domański: \Drupal\Tests\views\Kernel\Entity\...

  • catch committed ecca84f on 8.7.x
    Issue #3046697 by Krzysztof Domański: \Drupal\Tests\views\Kernel\Entity\...
catch’s picture

Version: 8.8.x-dev » 8.7.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.8.x and 8.7.x, thanks!

Status: Fixed » Closed (fixed)

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