Skip to content
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

Merged
merged 1 commit into from
Nov 30, 2021
Merged

Conversation

insom
Copy link
Contributor

@insom insom commented Nov 30, 2021

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.

@insom insom force-pushed the fix-tracking-tests branch from 04e8f36 to 366bd0d Compare November 30, 2021 02:56
@insom insom marked this pull request as ready for review November 30, 2021 03:05
@insom
Copy link
Contributor Author

insom commented Nov 30, 2021

cc @byroot

@byroot
Copy link
Contributor

byroot commented Nov 30, 2021

There are unrelated failures to #1220 which I haven't addressed.

Yeah I already dealt with them in other PRs.

Thank you for the fix!

@tenderlove tenderlove merged commit 4c034f1 into brianmario:master Nov 30, 2021
@tenderlove tenderlove deleted the fix-tracking-tests branch November 30, 2021 19:15
Copy link
Collaborator

@sodabrew sodabrew left a 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';")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
@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';")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
@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;")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
@client.query("START TRANSACTION;")
@client.query("START TRANSACTION")

@tenderlove
Copy link
Collaborator

@sodabrew sorry about merging before you could comment! I'll make the changes you suggest and put them in a new PR

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.

CI Failure: Session tracking test failing against mysql 8
4 participants