-
Notifications
You must be signed in to change notification settings - Fork 550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix session tracking tests #1222
Conversation
04e8f36
to
366bd0d
Compare
cc @byroot |
Yeah I already dealt with them in other PRs. Thank you for the fix! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a few review nits for this one, nothing major. cc @tenderlove
@@ -1078,19 +1078,24 @@ def run_gc | |||
end | |||
|
|||
it "returns multiple session track type values when available" do | |||
@client.query("SET @@SESSION.session_track_transaction_info='CHARACTERISTICS'") | |||
@client.query("SET @@SESSION.session_track_transaction_info='CHARACTERISTICS';") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@client.query("SET @@SESSION.session_track_transaction_info='CHARACTERISTICS';") | |
@client.query("SET @@SESSION.session_track_transaction_info='CHARACTERISTICS'") |
This semicolon shouldn't be needed.
res = @client.session_track(Mysql2::Client::SESSION_TRACK_STATE_CHANGE) | ||
expect(res).to be_nil | ||
it "returns valid transaction state inside a transaction" do | ||
@client.query("SET @@SESSION.session_track_transaction_info='CHARACTERISTICS';") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@client.query("SET @@SESSION.session_track_transaction_info='CHARACTERISTICS';") | |
@client.query("SET @@SESSION.session_track_transaction_info='CHARACTERISTICS'") |
Same again for the semicolon.
expect(res).to be_nil | ||
it "returns valid transaction state inside a transaction" do | ||
@client.query("SET @@SESSION.session_track_transaction_info='CHARACTERISTICS';") | ||
@client.query("START TRANSACTION;") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@client.query("START TRANSACTION;") | |
@client.query("START TRANSACTION") |
@sodabrew sorry about merging before you could comment! I'll make the changes you suggest and put them in a new PR |
closes #1220
I didn't write the original tests, but looking at them I think that they relied on undefined behaviour.
I've broken the check for transaction state tracking into its own test, and followed the tests that MySQL itself performs in its test suite:
https://github.com/mysql/mysql-server/blob/3290a66c89eb1625a7058e0ef732432b6952b435/mysql-test/r/session_tracker_trx_state.result#L154L159
The original test (which checks that multiple client state updates can be read) is still valid.
Arguably this new test isn't testing my original library changes anyway, it's testing MySQL client behaviour, but I don't want to just remove a failing test to make things pass 😬
There are unrelated failures to #1220 which I haven't addressed.