Make WordPress Core

Opened 7 years ago

Last modified 6 years ago

#41425 new enhancement

Killing phpunit may result in a broken database

Reported by: bobbingwide's profile bobbingwide Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9
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 7 years ago.
Define WP_REPAIRING to avoid database connection error when tables are missing

Download all attachments as: .zip

Change History (5)

#1 @jdgrimes
7 years 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
7 years 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
7 years ago

Define WP_REPAIRING to avoid database connection error when tables are missing

#3 in reply to: ↑ 2 @bobbingwide
7 years 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.

#4 @jblz
6 years ago

I ran up against this and temporarily defining WP_REPAIRING as done in the patch helped me fix the install so I could resume what I was testing.

Thanks for the workaround!

Note: See TracTickets for help on using tickets.