WordPress.org

Make WordPress Core

Opened 4 weeks ago

Last modified 4 weeks ago

#41425 new enhancement

Killing phpunit may result in a broken database

Reported by: bobbingwide Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: trunk
Component: Build/Test Tools Keywords: has-patch
Focuses: Cc:

Description

While running phpunit for wordpress-develop under Windows I hit ctrl-break during the Install processing.

The next time I ran phpunit it didn't work.

Actual output

"Error establishing a database connection"
<p>One or more database tables are unavailable. The database may need to be <a href="maint/repair.php?referrer=is_blog_installed">repaired</a>.</p></body>

Expected output

The install routine should drop and recreate the tables during Install

Explanation

The process was killed after the wp_options table was dropped but before wp_install() had completed.

Workaround

Either change $table_prefix in wp-tests-config.php or drop all the other tables that are missing and re-run.

Attachments (1)

41425.diff (452 bytes) - added by bobbingwide 4 weeks ago.
Define WP_REPAIRING to avoid database connection error when tables are missing

Download all attachments as: .zip

Change History (4)

#1 @jdgrimes
4 weeks ago

Something similar can also happen if the tests are being run as multisite and they exit in the middle of a test involving creating additional sites on the network. (Or something like that, I don't remember the exact circumstance.)

#2 follow-up: @pbiron
4 weeks ago

I've experienced this...but can't reproduce it right now. Thus, I'm not sure at what point killing phpunit causes the problem.

The reasons I kill phpunit is when I realize I've started it with the wrong --group arg or I realize that one of the tests that I'm writing is wrong and don't want to wait for the incorrect tests to finish.

@bobbingwide
4 weeks ago

Define WP_REPAIRING to avoid database connection error when tables are missing

#3 in reply to: ↑ 2 @bobbingwide
4 weeks ago

  • Keywords has-patch added

Replying to pbiron:

The reasons I kill phpunit is when I realize I've started it with the wrong --group arg or I realize that one of the tests that I'm writing is wrong and don't want to wait for the incorrect tests to finish.

Ditto.

Note: See TracTickets for help on using tickets.