From f35dc4db9b2f951ef94b29af9662b7e3d280b86d Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Sat, 31 Oct 2026 12:18:18 +0100 Subject: [PATCH 1/4] Run the Behat tests in parallel workers Co-Authored-By: Claude Opus 5.5 --- composer.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 30122965..e9c6945d 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ }, "require-dev": { "wp-cli/entity-command": "^1.3 || ^2 || ^3", - "wp-cli/wp-cli-tests": "^5" + "wp-cli/wp-cli-tests": "dev-perf/parallel-scenarios#79d8ddadac6616da7b326634c4275aa37de708e2 as 5.1.99" }, "config": { "process-timeout": 7200, @@ -64,7 +64,10 @@ "minimum-stability": "dev", "prefer-stable": true, "scripts": { - "behat": "run-behat-tests", + "behat": [ + "@putenv WP_CLI_TEST_PARALLEL=4", + "run-behat-tests" + ], "behat-rerun": "rerun-behat-tests", "lint": "run-linter-tests", "lint-gherkin": "run-gherkin-lint-tests", From ba425d9264c6c4cb9a8c7e33ca02cb037462ae16 Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Sat, 31 Oct 2026 13:55:36 +0100 Subject: [PATCH 2/4] Expect the configured test database name and user Many scenarios expected the test database and its user to be called wp_cli_test, which only holds with the default configuration, and not for parallel test workers, which each use their own database. Co-Authored-By: Claude Opus 5.5 --- features/db-check.feature | 14 ++++---- features/db-export.feature | 56 ++++++++++++++--------------- features/db-import.feature | 72 +++++++++++++++++++------------------- features/db-query.feature | 6 ++-- features/db-size.feature | 14 ++++---- features/db.feature | 12 +++---- 6 files changed, 87 insertions(+), 87 deletions(-) diff --git a/features/db-check.feature b/features/db-check.feature index 744219ea..30986dfd 100644 --- a/features/db-check.feature +++ b/features/db-check.feature @@ -7,7 +7,7 @@ Feature: Check the database When I run `wp db check` Then STDOUT should contain: """ - wp_cli_test.wp_users + {DB_NAME}.wp_users """ And STDOUT should contain: """ @@ -28,7 +28,7 @@ Feature: Check the database When I run `wp db check --silent` Then STDOUT should not contain: """ - wp_cli_test.wp_users + {DB_NAME}.wp_users """ And STDOUT should contain: """ @@ -42,7 +42,7 @@ Feature: Check the database When I run `wp db check --defaults` Then STDOUT should contain: """ - wp_cli_test.wp_users + {DB_NAME}.wp_users """ And STDOUT should contain: """ @@ -56,7 +56,7 @@ Feature: Check the database When I run `wp db check --no-defaults` Then STDOUT should contain: """ - wp_cli_test.wp_users + {DB_NAME}.wp_users """ And STDOUT should contain: """ @@ -67,7 +67,7 @@ Feature: Check the database Scenario: Run db check with passed-in options Given a WP install - When I run `wp db check --dbuser=wp_cli_test` + When I run `wp db check --dbuser={DB_USER}` Then STDOUT should contain: """ Success: Database checked. @@ -79,7 +79,7 @@ Feature: Check the database Success: Database checked. """ - When I run `wp db check --dbuser=wp_cli_test --dbpass=password1` + When I run `wp db check --dbuser={DB_USER} --dbpass=password1` Then STDOUT should contain: """ Success: Database checked. @@ -101,7 +101,7 @@ Feature: Check the database """ And STDOUT should be empty - When I try `wp db check --dbuser=wp_cli_test --verbose` + When I try `wp db check --dbuser={DB_USER} --verbose` Then the return code should be 0 And STDOUT should contain: """ diff --git a/features/db-export.feature b/features/db-export.feature index 6303f608..91061357 100644 --- a/features/db-export.feature +++ b/features/db-export.feature @@ -6,59 +6,59 @@ Feature: Export a WordPress database When I run `wp db export --porcelain` Then STDOUT should contain: """ - wp_cli_test- + {DB_NAME}- """ - And the wp_cli_test.sql file should not exist + And the {DB_NAME}.sql file should not exist Scenario: Database export to a specified file path Given a WP install - When I run `wp db export wp_cli_test.sql --porcelain` + When I run `wp db export {DB_NAME}.sql --porcelain` Then STDOUT should contain: """ - wp_cli_test.sql + {DB_NAME}.sql """ - And the wp_cli_test.sql file should exist + And the {DB_NAME}.sql file should exist @skip-sqlite Scenario: Exclude tables when exporting the database Given a WP install - When I try `wp db export wp_cli_test.sql --exclude_tables=wp_users --porcelain` - Then the wp_cli_test.sql file should exist - And the contents of the wp_cli_test.sql file should not match /CREATE TABLE ["`]?wp_users["`]?/ - And the contents of the wp_cli_test.sql file should match /CREATE TABLE ["`]?wp_options["`]?/ + When I try `wp db export {DB_NAME}.sql --exclude_tables=wp_users --porcelain` + Then the {DB_NAME}.sql file should exist + And the contents of the {DB_NAME}.sql file should not match /CREATE TABLE ["`]?wp_users["`]?/ + And the contents of the {DB_NAME}.sql file should match /CREATE TABLE ["`]?wp_options["`]?/ @skip-sqlite Scenario: Include only specific tables when exporting the database Given a WP install - When I try `wp db export wp_cli_test.sql --tables=wp_users --porcelain` - Then the wp_cli_test.sql file should exist - And the contents of the wp_cli_test.sql file should match /CREATE TABLE ["`]?wp_users["`]?/ - And the contents of the wp_cli_test.sql file should not match /CREATE TABLE ["`]?wp_posts["`]?/ - And the contents of the wp_cli_test.sql file should not match /CREATE TABLE ["`]?wp_options["`]?/ + When I try `wp db export {DB_NAME}.sql --tables=wp_users --porcelain` + Then the {DB_NAME}.sql file should exist + And the contents of the {DB_NAME}.sql file should match /CREATE TABLE ["`]?wp_users["`]?/ + And the contents of the {DB_NAME}.sql file should not match /CREATE TABLE ["`]?wp_posts["`]?/ + And the contents of the {DB_NAME}.sql file should not match /CREATE TABLE ["`]?wp_options["`]?/ @require-sqlite Scenario: Exclude tables when exporting the database Given a WP install - When I try `wp db export wp_cli_test.sql --exclude_tables=wp_users --porcelain` - Then the wp_cli_test.sql file should exist - And the contents of the wp_cli_test.sql file should not match /_mysql_data_types_cache/ - And the contents of the wp_cli_test.sql file should not match /CREATE TABLE ["`]?wp_users["`]?/ - And the contents of the wp_cli_test.sql file should match /CREATE TABLE ["`]?wp_options["`]?/ + When I try `wp db export {DB_NAME}.sql --exclude_tables=wp_users --porcelain` + Then the {DB_NAME}.sql file should exist + And the contents of the {DB_NAME}.sql file should not match /_mysql_data_types_cache/ + And the contents of the {DB_NAME}.sql file should not match /CREATE TABLE ["`]?wp_users["`]?/ + And the contents of the {DB_NAME}.sql file should match /CREATE TABLE ["`]?wp_options["`]?/ @require-sqlite Scenario: Include only specific tables when exporting the database Given a WP install - When I try `wp db export wp_cli_test.sql --tables=wp_users --porcelain` - Then the wp_cli_test.sql file should exist - And the contents of the wp_cli_test.sql file should not match /_mysql_data_types_cache/ - And the contents of the wp_cli_test.sql file should match /CREATE TABLE ["`]?wp_users["`]?/ - And the contents of the wp_cli_test.sql file should not match /CREATE TABLE ["`]?wp_posts["`]?/ - And the contents of the wp_cli_test.sql file should not match /CREATE TABLE ["`]?wp_options["`]?/ + When I try `wp db export {DB_NAME}.sql --tables=wp_users --porcelain` + Then the {DB_NAME}.sql file should exist + And the contents of the {DB_NAME}.sql file should not match /_mysql_data_types_cache/ + And the contents of the {DB_NAME}.sql file should match /CREATE TABLE ["`]?wp_users["`]?/ + And the contents of the {DB_NAME}.sql file should not match /CREATE TABLE ["`]?wp_posts["`]?/ + And the contents of the {DB_NAME}.sql file should not match /CREATE TABLE ["`]?wp_options["`]?/ @require-sqlite Scenario: Export database to STDOUT @@ -153,10 +153,10 @@ Feature: Export a WordPress database Scenario: Export database when PHP exec() is disabled Given a WP install - When I try `{INVOKE_WP_CLI_WITH_PHP_ARGS--ddisable_functions=exec} db export wp_cli_test.sql --porcelain` + When I try `{INVOKE_WP_CLI_WITH_PHP_ARGS--ddisable_functions=exec} db export {DB_NAME}.sql --porcelain` Then the return code should be 0 And STDOUT should contain: """ - wp_cli_test.sql + {DB_NAME}.sql """ - And the wp_cli_test.sql file should exist + And the {DB_NAME}.sql file should exist diff --git a/features/db-import.feature b/features/db-import.feature index 1c9c324d..dcfb3a47 100644 --- a/features/db-import.feature +++ b/features/db-import.feature @@ -3,37 +3,37 @@ Feature: Import a WordPress database Scenario: Import from database name path by default Given a WP install - When I run `wp db export wp_cli_test.sql` - Then the wp_cli_test.sql file should exist + When I run `wp db export {DB_NAME}.sql` + Then the {DB_NAME}.sql file should exist When I run `wp db import` Then STDOUT should be: """ - Success: Imported from 'wp_cli_test.sql'. + Success: Imported from '{DB_NAME}.sql'. """ Scenario: Import from database name path by default with mysql defaults Given a WP install - When I run `wp db export wp_cli_test.sql` - Then the wp_cli_test.sql file should exist + When I run `wp db export {DB_NAME}.sql` + Then the {DB_NAME}.sql file should exist When I run `wp db import --defaults` Then STDOUT should be: """ - Success: Imported from 'wp_cli_test.sql'. + Success: Imported from '{DB_NAME}.sql'. """ Scenario: Import from database name path by default with --no-defaults Given a WP install - When I run `wp db export wp_cli_test.sql` - Then the wp_cli_test.sql file should exist + When I run `wp db export {DB_NAME}.sql` + Then the {DB_NAME}.sql file should exist When I run `wp db import --no-defaults` Then STDOUT should be: """ - Success: Imported from 'wp_cli_test.sql'. + Success: Imported from '{DB_NAME}.sql'. """ @require-mysql-or-mariadb @@ -60,13 +60,13 @@ Feature: Import a WordPress database Scenario: Import from database name path by default and skip speed optimization Given a WP install - When I run `wp db export wp_cli_test.sql` - Then the wp_cli_test.sql file should exist + When I run `wp db export {DB_NAME}.sql` + Then the {DB_NAME}.sql file should exist When I run `wp db import --skip-optimization` Then STDOUT should be: """ - Success: Imported from 'wp_cli_test.sql'. + Success: Imported from '{DB_NAME}.sql'. """ # SQLite doesn't support the --dbuser flag. @@ -74,16 +74,16 @@ Feature: Import a WordPress database Scenario: Import from database name path by default with passed-in dbuser/dbpass Given a WP install - When I run `wp db export wp_cli_test.sql` - Then the wp_cli_test.sql file should exist + When I run `wp db export {DB_NAME}.sql` + Then the {DB_NAME}.sql file should exist - When I run `wp db import --dbuser=wp_cli_test --dbpass=password1` + When I run `wp db import --dbuser={DB_USER} --dbpass=password1` Then STDOUT should be: """ - Success: Imported from 'wp_cli_test.sql'. + Success: Imported from '{DB_NAME}.sql'. """ - When I try `wp db import --dbuser=wp_cli_test --dbpass=no_such_pass` + When I try `wp db import --dbuser={DB_USER} --dbpass=no_such_pass` Then the return code should not be 0 And STDERR should contain: """ @@ -116,10 +116,10 @@ Feature: Import a WordPress database Scenario: Import forwards the --ssl flag to the MySQL client Given a WP install - When I run `wp db export wp_cli_test.sql` - Then the wp_cli_test.sql file should exist + When I run `wp db export {DB_NAME}.sql` + Then the {DB_NAME}.sql file should exist - When I try `wp db import wp_cli_test.sql --ssl --debug` + When I try `wp db import {DB_NAME}.sql --ssl --debug` Then STDERR should contain: """ --ssl @@ -170,8 +170,8 @@ Feature: Import a WordPress database Scenario: MySQL defaults are available as appropriate with --defaults flag Given a WP install - When I run `wp db export wp_cli_test.sql` - Then the wp_cli_test.sql file should exist + When I run `wp db export {DB_NAME}.sql` + Then the {DB_NAME}.sql file should exist When I try `wp db import --defaults --debug` Then STDERR should match #Debug \(db\): Running shell command: /([^/]+/)+(mysql|mariadb) --no-auto-rehash# @@ -194,9 +194,9 @@ Feature: Import a WordPress database 🍣 """ - When I try `wp db export wp_cli_test.sql --debug` + When I try `wp db export {DB_NAME}.sql --debug` Then the return code should be 0 - And the wp_cli_test.sql file should exist + And the {DB_NAME}.sql file should exist And STDERR should contain: """ Detected character set of the posts table: utf8mb4 @@ -206,10 +206,10 @@ Feature: Import a WordPress database Setting missing default character set to utf8mb4 """ - When I run `wp db import --dbuser=wp_cli_test --dbpass=password1` + When I run `wp db import --dbuser={DB_USER} --dbpass=password1` Then STDOUT should be: """ - Success: Imported from 'wp_cli_test.sql'. + Success: Imported from '{DB_NAME}.sql'. """ When I run `wp post list` @@ -231,14 +231,14 @@ Feature: Import a WordPress database 🍣 """ - When I try `wp db export wp_cli_test.sql --debug` + When I try `wp db export {DB_NAME}.sql --debug` Then the return code should be 0 - And the wp_cli_test.sql file should exist + And the {DB_NAME}.sql file should exist - When I run `wp db import --dbuser=wp_cli_test --dbpass=password1` + When I run `wp db import --dbuser={DB_USER} --dbpass=password1` Then STDOUT should be: """ - Success: Imported from 'wp_cli_test.sql'. + Success: Imported from '{DB_NAME}.sql'. """ When I run `wp post list` @@ -316,14 +316,14 @@ Feature: Import a WordPress database Scenario: `wp db import` adapts the SQL mode via --init-command by default Given a WP install - When I run `wp db export wp_cli_test.sql` - Then the wp_cli_test.sql file should exist + When I run `wp db export {DB_NAME}.sql` + Then the {DB_NAME}.sql file should exist # The WordPress-compatibility mode adaptation runs on the same import # connection via --init-command, so it is visible in the debug output and no # separate mode probe runs (which is what used to break with custom connection # options). - When I try `wp db import wp_cli_test.sql --debug` + When I try `wp db import {DB_NAME}.sql --debug` Then the return code should be 0 And STDERR should contain: """ @@ -338,10 +338,10 @@ Feature: Import a WordPress database Scenario: `wp db import --skip-sql-mode-compat` imports under the server's own SQL modes Given a WP install - When I run `wp db export wp_cli_test.sql` - Then the wp_cli_test.sql file should exist + When I run `wp db export {DB_NAME}.sql` + Then the {DB_NAME}.sql file should exist - When I try `wp db import wp_cli_test.sql --skip-sql-mode-compat --debug` + When I try `wp db import {DB_NAME}.sql --skip-sql-mode-compat --debug` Then the return code should be 0 And STDERR should not contain: """ diff --git a/features/db-query.feature b/features/db-query.feature index 6876593c..ccbff1ac 100644 --- a/features/db-query.feature +++ b/features/db-query.feature @@ -26,7 +26,7 @@ Feature: Query the database with WordPress' MySQL config Scenario: Database querying with passed-in options Given a WP install - When I run `wp db query "SELECT COUNT(ID) FROM wp_posts;" --dbuser=wp_cli_test --html` + When I run `wp db query "SELECT COUNT(ID) FROM wp_posts;" --dbuser={DB_USER} --html` Then STDOUT should contain: """ Date: Sat, 31 Oct 2026 13:55:47 +0100 Subject: [PATCH 3/4] Use the latest fixes for parallel Behat runs Co-Authored-By: Claude Opus 5.5 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e9c6945d..4e502bd6 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ }, "require-dev": { "wp-cli/entity-command": "^1.3 || ^2 || ^3", - "wp-cli/wp-cli-tests": "dev-perf/parallel-scenarios#79d8ddadac6616da7b326634c4275aa37de708e2 as 5.1.99" + "wp-cli/wp-cli-tests": "dev-ci/parallel-integration#97797bbc5dd40d88842afa901f4cd66bc102ddaa as 5.1.99" }, "config": { "process-timeout": 7200, From e2b63d4acce4e501810a730df6588fcc0d4bdf8a Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Sat, 31 Oct 2026 16:46:48 +0100 Subject: [PATCH 4/4] Test the latest parallel integration branch Co-Authored-By: Claude Opus 5.5 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4e502bd6..d2817361 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ }, "require-dev": { "wp-cli/entity-command": "^1.3 || ^2 || ^3", - "wp-cli/wp-cli-tests": "dev-ci/parallel-integration#97797bbc5dd40d88842afa901f4cd66bc102ddaa as 5.1.99" + "wp-cli/wp-cli-tests": "dev-ci/parallel-integration#04a78ab9833119b5af984ea4d17a2153ae69547f as 5.1.99" }, "config": { "process-timeout": 7200,