Problem/Motivation

Although this is a kernel test it runs 40 tests methods, 5 of which skip after doing a fair bit of setup.

Steps to reproduce

(numbers from my local dev environment)

Before:

Time: 01:00.910, Memory: 6.00 MB

OK, but some tests were skipped!
Tests: 40, Assertions: 2835, Skipped: 5.

After:

Time: 00:55.201, Memory: 6.00 MB

OK, but some tests were skipped!
Tests: 43, Assertions: 2500, Skipped: 8.

There are three more tests skipped and you would expect because of the way that data providers work, confirmed it's the same five methods getting skipped, just we mark one skipped three times instead of once this way.

On gitlab:
Before:

Drupal\Tests\content_moderation\Kernel\WorkspacesContentMode  40 passes  133s 

After:

Drupal\Tests\content_moderation\Kernel\WorkspacesContentMode  43 passes  122s

This isn't saving lots of time, but it's saving a few seconds from what is a very long test for a kernel test (on slower pods it can take a fair bit longer than 130s).

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3468829

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

catch created an issue. See original summary.

catch’s picture

Status: Active » Needs review

catch’s picture

Issue summary: View changes
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

I'm willing to bet that this change didn't break nightwatch. Neat solution for skipping those tests

  • nod_ committed e53b0392 on 10.3.x
    Issue #3468829 by catch, smustgrave: Speed up...

  • nod_ committed 9a0f1ff6 on 10.4.x
    Issue #3468829 by catch, smustgrave: Speed up...

  • nod_ committed 7135f09a on 11.0.x
    Issue #3468829 by catch, smustgrave: Speed up...

  • nod_ committed f06e0f3f on 11.x
    Issue #3468829 by catch, smustgrave: Speed up...
nod_’s picture

Version: 11.x-dev » 10.3.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed f06e0f3f47 to 11.x and 7135f09a09 to 11.0.x and 9a0f1ff644 to 10.4.x and e53b039258 to 10.3.x. Thanks!

  • nod_ committed b016a8c1 on 10.4.x
    Revert "Issue #3468829 by catch, smustgrave: Speed up...

  • nod_ committed d40f8482 on 10.3.x
    Revert "Issue #3468829 by catch, smustgrave: Speed up...
nod_’s picture

Version: 10.3.x-dev » 11.0.x-dev

seems it's causing issues in 10.4.x and 10.3.x reverting them for now
ex: https://git.drupalcode.org/project/drupal/-/pipelines/260708/test_report...

spokje’s picture

Version: 11.0.x-dev » 10.4.x-dev
Assigned: Unassigned » spokje
Status: Fixed » Patch (to be ported)

Setting to the IMHO correct state.

Spokje changed the visibility of the branch 3468829-speed-up-workspacescontentmoderationstatetest to active.

Spokje changed the visibility of the branch 3468829-speed-up-workspacescontentmoderationstatetest to hidden.

spokje’s picture

Status: Patch (to be ported) » Needs review
spokje’s picture

Assigned: spokje » Unassigned
spokje’s picture

Looks like we hit an interesting difference between PHPUnit 9 and 10.

In 9, for a test to be picked up by its class' setUp() it has to be defined in that class, even though there's also an implementation in its base-class.
In 10, when there's a definition in the base-class, the setUp() of the extending class will pick up on each test, even when only defined in the base-class.

Added some empty-bodied (except some explanatory comment) tests-to-be-skipped and all seems well now in the land of 10.x

  • nod_ committed b3ac46ae on 10.3.x
    Issue #3468829 by Spokje: Follow-up Speed up...

  • nod_ committed 7f653a7d on 10.4.x
    Issue #3468829 by Spokje: Follow-up Speed up...
nod_’s picture

Version: 10.4.x-dev » 10.3.x-dev
Status: Needs review » Fixed

Perfect, thanks.

Committed and pushed 7f653a7d6b to 10.4.x and b3ac46aee4 to 10.3.x. Thanks!

Status: Fixed » Closed (fixed)

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