Problem/Motivation

The Drupal core test suite takes ~60 minutes to test Drupal 10.

This:

  1. slows down and hence discourages contributions
  2. costs a lot to the Drupal Association

We did this a lot while working to get the CKEditor 5 module stable. It saved countless hours, allowed for faster iterations and saved many DA dollars. It required applying this patch:

diff --git a/core/drupalci.yml b/core/drupalci.yml
index 94aa2ad22f..6b4e9a767b 100644
--- a/core/drupalci.yml
+++ b/core/drupalci.yml
@@ -15,30 +15,30 @@ build:
       # deprecated code.
       run_tests.phpunit:
         types: 'PHPUnit-Unit'
-        testgroups: '--all'
+        testgroups: '--module ckeditor5'
         suppress-deprecations: false
         halt-on-fail: false
       run_tests.kernel:
         types: 'PHPUnit-Kernel'
-        testgroups: '--all'
+        testgroups: '--module ckeditor5'
         suppress-deprecations: false
         halt-on-fail: false
       run_tests.build:
         # Limit concurrency due to disk space concerns.
         concurrency: 15
         types: 'PHPUnit-Build'
-        testgroups: '--all'
+        testgroups: '--module ckeditor5'
         suppress-deprecations: false
         halt-on-fail: false
       run_tests.functional:
         types: 'PHPUnit-Functional'
-        testgroups: '--all'
+        testgroups: '--module ckeditor5'
         suppress-deprecations: false
         halt-on-fail: false
       run_tests.javascript:
         concurrency: 15
         types: 'PHPUnit-FunctionalJavascript'
-        testgroups: '--all'
+        testgroups: '--module ckeditor5'
         suppress-deprecations: false
         halt-on-fail: false
       # Run nightwatch testing.
diff --git a/core/package.json b/core/package.json
index c14f58a08c..cc55f438eb 100644
--- a/core/package.json
+++ b/core/package.json
@@ -18,7 +18,7 @@
     "lint:css": "stylelint \"**/*.css\"",
     "lint:css-checkstyle": "stylelint \"**/*.css\" --custom-formatter ./node_modules/stylelint-checkstyle-formatter/index.js",
     "lint:yaml": "node ./node_modules/eslint/bin/eslint.js --ext .yml .",
-    "test:nightwatch": "node -r dotenv-safe/config ./node_modules/.bin/nightwatch --config ./tests/Drupal/Nightwatch/nightwatch.conf.js",
+    "test:nightwatch": "node -r dotenv-safe/config ./node_modules/.bin/nightwatch --config ./tests/Drupal/Nightwatch/nightwatch.conf.js --tag ckeditor5",
     "prettier": "prettier --write \"./**/*.js\"",
     "spellcheck": "cspell",
     "spellcheck:make-drupal-dict": "rm -f misc/cspell/dictionary.txt && touch misc/cspell/dictionary.txt && yarn -s spellcheck:core --unique --wordsOnly | tr '[:upper:]' '[:lower:]' | tr -d \\\\\\\\ | LC_ALL=C sort -u -o misc/cspell/dictionary.txt",

But it's not reasonable to expect all Drupal core contributors to figure this out.

Steps to reproduce

Post a patch or an MR.

Proposed resolution

Many (most?) changes to Drupal core actually apply only to a single module.

So … why not make it as simple as possible to run only the tests for a particular Drupal core module? Yes, soonish we'll transition from Drupal CI to GitLab CI. But even before then, there's a very low-cost, low-effort way to make it easie. What if you'd only have to change this in core/drupalci.yml:

_phpunit_testgroups_to_execute: &testgroups
  # Default: all of Drupal core's test suite runs.
  testgroups: '--all'
  # Alternative: run only the tests for one particular module.
  # testgroups: '--module ckeditor5'

to this:

_phpunit_testgroups_to_execute: &testgroups
  # Default: all of Drupal core's test suite runs.
  #testgroups: '--all'
  # Alternative: run only the tests for one particular module.
  testgroups: '--module ckeditor5'

(comment one line, uncomment another)

Note: this will not eliminate all nightwatch tests from running (because that does not use PHPUnit and requires tweaking core/package.json), which takes ~6.5 minutes, but tweaking that can be a follow-up improvement. This alone cuts ~66% off the test run time.

This alone would cut makes a huge difference.

Remaining tasks

Review

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

None.

Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

Status: Active » Needs review
StatusFileSize
new1.87 KB
wim leers’s picture

wim leers’s picture

Voila: #3 took exactly 20 minutes, or exactly 33% of the usual build duration! #2 is still going…

alexpott’s picture

Category: Feature request » Task

+1 this is a good idea. It's not a feature though :)

alexpott’s picture

+++ b/core/drupalci.yml
@@ -15,32 +20,32 @@ build:
-        testgroups: '--all'
+        testgroups: '--module ckeditor5'

Should be the Yaml anchor link

mstrelan’s picture

I suspect we'll see an even greater time reduction for modules that are not so js heavy, perhaps down to 15 minutes, or 10 if we can skip nightwatch tests too!

tedbow’s picture

Great addition!

re #6 didn't know about "Yaml anchor link", that makes this much easier to use!

tedbow’s picture

Status: Needs review » Reviewed & tested by the community
longwave’s picture

Status: Reviewed & tested by the community » Needs work

NW for #6, build tests are currently hardcoded to CKEditor 5 only.

+++ b/core/drupalci.yml
@@ -15,32 +20,32 @@ build:
         suppress-deprecations: false
         halt-on-fail: false

Should we consider putting these in the shared group as well? I guess if you want to change one setting, you usually want to change them for all groups?

wim leers’s picture

Status: Needs work » Needs review
StatusFileSize
new586 bytes
new1.76 KB

#6: HAH! I forgot to update that one clearly 😄

#10: that's a bikeshed discussion I don't want to bother with at this time 😇

longwave’s picture

Status: Needs review » Reviewed & tested by the community

OK, let's just make this part easier for now :)

alexpott’s picture

Version: 10.1.x-dev » 9.4.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed 13c1ec1085 to 10.1.x and 79cbf8a2d2 to 10.0.x and 71fd615e28 to 9.5.x and 3a05ba49aa to 9.4.x. Thanks!

Backported to 9.4.x because there is no reason not to.

  • alexpott committed 13c1ec1 on 10.1.x
    Issue #3313833 by Wim Leers, longwave, alexpott: Make it easy to run...

  • alexpott committed 79cbf8a on 10.0.x
    Issue #3313833 by Wim Leers, longwave, alexpott: Make it easy to run...

  • alexpott committed 71fd615 on 9.5.x
    Issue #3313833 by Wim Leers, longwave, alexpott: Make it easy to run...

  • alexpott committed 3a05ba4 on 9.4.x
    Issue #3313833 by Wim Leers, longwave, alexpott: Make it easy to run...

Status: Fixed » Closed (fixed)

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