Skip to content

Commit

Permalink
Session tracking: account for MySQL 8 reporting statement_id changes …
Browse files Browse the repository at this point in the history
…along with other system variables
  • Loading branch information
jeremy committed Aug 3, 2023
1 parent 6cf5e1d commit fa486af
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions spec/mysql2/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ def run_gc
it "returns changes system variables for SESSION_TRACK_SYSTEM_VARIABLES" do
@client.query("SET @@SESSION.session_track_state_change=ON;")
res = @client.session_track(Mysql2::Client::SESSION_TRACK_SYSTEM_VARIABLES)
expect(res).to eq(%w[session_track_state_change ON])
expect(res).to include("session_track_state_change", "ON")
end

it "returns database name for SESSION_TRACK_SCHEMA" do
Expand All @@ -1096,21 +1096,21 @@ def run_gc
@client.query("SET @@SESSION.session_track_transaction_info='CHARACTERISTICS';")

res = @client.session_track(Mysql2::Client::SESSION_TRACK_SYSTEM_VARIABLES)
expect(res).to eq(%w[session_track_transaction_info CHARACTERISTICS])
expect(res).to include("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([""])
expect(res).to include("")
end

it "returns valid transaction state inside a transaction" do
@client.query("SET @@SESSION.session_track_transaction_info='CHARACTERISTICS'")
@client.query("START TRANSACTION")

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

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

0 comments on commit fa486af

Please sign in to comment.