Skip to content

Commit fb72073

Browse files
committed
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.
1 parent e0783e6 commit fb72073

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

features/db.feature

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,18 @@ Feature: Perform database operations
181181
"""
182182
And STDOUT should be empty
183183
184-
# Verbose option prints to STDERR.
185-
When I try `wp db repair --verbose`
184+
# `--verbose` makes the check command print progress information. MySQL's
185+
# mysqlcheck writes "# Connecting to ..." to STDERR at a single --verbose,
186+
# while MariaDB's mariadb-check writes "Processing databases" to STDOUT and
187+
# only prints connection information at a higher verbosity. Merge the streams
188+
# and accept either client's marker.
189+
When I try `wp db repair --verbose 2>&1`
186190
Then the return code should be 0
187-
And STDERR should contain:
191+
And STDOUT should match /(?:# Connecting to |Processing databases)/
192+
And STDOUT should contain:
188193
"""
189-
Connecting
194+
Success: Database repaired.
190195
"""
191-
And STDOUT should not be empty
192196

193197
@skip-sqlite
194198
Scenario: db repair with --quiet flag should only show errors

0 commit comments

Comments
 (0)