Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#2 | 3046697-2.patch | 1.07 KB | Krzysztof Domański |
#2 | 3046697-2-test-only.patch | 1.07 KB | Krzysztof Domański |
Comments
Comment #2
Krzysztof Domański1. I added ascending sorting by nid to test_entity_row_renderers_revisions_base.
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
Comment #4
dagmarYes, 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
Comment #7
catchCommitted/pushed to 8.8.x and 8.7.x, thanks!