From fb720736f035d3583df28698b2a5344c1249718b Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Tue, 21 Jul 2026 12:30:14 +0200 Subject: [PATCH] Fix `wp db repair --verbose` test for MariaDB The "DB Operations with passed-in options" scenario asserted that `wp db repair --verbose` writes "Connecting" to STDERR. That only holds on MySQL: its mysqlcheck writes `# Connecting to ...` to STDERR at a single `--verbose`, but MariaDB's mariadb-check writes `Processing databases` to STDOUT and only prints connection information at a higher verbosity level, so the assertion failed on MariaDB. There is no single verbose-only string both clients emit at one `--verbose`, so merge the streams and match either client's marker, and assert the `wp db repair` success message so the scenario still proves the command ran. --- features/db.feature | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/features/db.feature b/features/db.feature index 7a58c3a2..2fcbe899 100644 --- a/features/db.feature +++ b/features/db.feature @@ -181,14 +181,18 @@ Feature: Perform database operations """ And STDOUT should be empty - # Verbose option prints to STDERR. - When I try `wp db repair --verbose` + # `--verbose` makes the check command print progress information. MySQL's + # mysqlcheck writes "# Connecting to ..." to STDERR at a single --verbose, + # while MariaDB's mariadb-check writes "Processing databases" to STDOUT and + # only prints connection information at a higher verbosity. Merge the streams + # and accept either client's marker. + When I try `wp db repair --verbose 2>&1` Then the return code should be 0 - And STDERR should contain: + And STDOUT should match /(?:# Connecting to |Processing databases)/ + And STDOUT should contain: """ - Connecting + Success: Database repaired. """ - And STDOUT should not be empty @skip-sqlite Scenario: db repair with --quiet flag should only show errors