Skip to content

Fix session tracking tests #1222

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

Merged
merged 1 commit into from
Nov 30, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions spec/mysql2/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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_TRANSACTION_STATE)
expect(res).to eq(["________"])
res = @client.session_track(Mysql2::Client::SESSION_TRACK_SYSTEM_VARIABLES)
expect(res).to eq(%w[session_track_transaction_info CHARACTERISTICS])

res = @client.session_track(Mysql2::Client::SESSION_TRACK_STATE_CHANGE)
expect(res).to be_nil

res = @client.session_track(Mysql2::Client::SESSION_TRACK_TRANSACTION_CHARACTERISTICS)
expect(res).to eq([""])
end

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.

@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")


res = @client.session_track(Mysql2::Client::SESSION_TRACK_SYSTEM_VARIABLES)
expect(res).to eq(%w[session_track_transaction_info CHARACTERISTICS])
res = @client.session_track(Mysql2::Client::SESSION_TRACK_TRANSACTION_STATE)
expect(res).to eq(["T_______"])
end

it "returns empty array if session track type not found" do
Expand Down