Problem/Motivation

\Drupal\Tests\user\Kernel\Views\HandlerFilterCurrentUserTest:: testFilterCurrentUserAsAnonymous() can randomly fail.
See https://www.drupal.org/pift-ci-job/1254268

1) Drupal\Tests\user\Kernel\Views\HandlerFilterCurrentUserTest::testFilterCurrentUserAsAnonymous
Anonymous account can view all accounts when current filter is FALSE.
Failed asserting that Array &0 (
    0 => Array &1 (
        'uid' => '3'
    )
    1 => Array &2 (
        'uid' => '1'
    )
    2 => Array &3 (
        'uid' => '2'
    )
    3 => Array &4 (
        'uid' => '4'
    )
) is identical to Array &0 (
    0 => Array &1 (
        'uid' => '1'
    )
    1 => Array &2 (
        'uid' => '2'
    )
    2 => Array &3 (
        'uid' => '3'
    )
    3 => Array &4 (
        'uid' => '4'
    )
).

Proposed resolution

Fix the code so the order is not an unstable sort (I guess)

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alexpott created an issue. See original summary.

Krzysztof Domański’s picture

Status: Active » Needs review
Issue tags: +Random test failure
FileSize
1.01 KB
1.01 KB

1. I added ascending sorting by uid to test_filter_current_user.

/**
 * Views used by this test.
 *
 * @var array
 */
public static $testViews = ['test_filter_current_user'];

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

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

dawehner’s picture

Status: Needs review » Reviewed & tested by the community
+++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_filter_current_user.yml
@@ -103,7 +103,21 @@ display:
+      sorts:
+        uid:
+          id: uid
+          table: users_field_data
+          field: uid
+          relationship: none
+          group_type: group
+          admin_label: ''
+          order: ASC
+          exposed: false
+          expose:
+            label: ''
+          entity_type: user
+          entity_field: uid
+          plugin_id: standard

Sorting is always a good thing! Thank you

Krzysztof Domański’s picture

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed 46b4700a89 to 8.8.x and 2a8794e465 to 8.7.x. Thanks!

  • alexpott committed 46b4700 on 8.8.x
    Issue #3046571 by Krzysztof Domański: \Drupal\Tests\user\Kernel\Views\...

  • alexpott committed 55a1981 on 8.7.x
    Issue #3046571 by Krzysztof Domański: \Drupal\Tests\user\Kernel\Views\...

Status: Fixed » Closed (fixed)

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