Skip to content

Conversation

dylanahsmith
Copy link
Contributor

Problem

As discussed in #848 (comment), the test I am changing fails in a flaky way due to mysql_close sending a quit command without waiting for a response, so the following query for the Threads_connected can return a count that includes the connection that was been closed on the client side.

Solution

Give the server a second to detect and response to the client closing the connection by using the SHOW PROCESSLIST command to check if the server still thinks the client is connected.

I wrapped the contents of the test in a loop as I commented in #848 (comment) to confirm that this deals with this type of flaky test failure.

end
}.to_not change {
@client.query("SHOW STATUS LIKE 'Aborted_%'").to_a +
@client.query("SHOW STATUS LIKE 'Threads_connected'").to_a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Threads_connected should change, huh?

Perhaps we should just check that the client connection wasn't aborted. The SHOW PROCESSLIST check is already demonstrating that the client is no longer connected, which is the aim of the spec.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Threads_connected should change, huh?

It should not change as the }.to_not change { line specifies, since the client was opened and closed in the expect block.

Sure, I could just check that it hasn't aborted here, which should hopefully also make this test likely to fail due to some connection from another test being closed by the garbage collector during the expect block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed this change

@sodabrew sodabrew added this to the 0.4.7 milestone May 31, 2017
@sodabrew sodabrew merged commit 71097b1 into brianmario:master May 31, 2017
@dylanahsmith dylanahsmith deleted the wait-for-close-in-test branch June 1, 2017 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants