diff --git a/spec/mysql2/client_spec.rb b/spec/mysql2/client_spec.rb index 3ec52db4..1519e0f5 100644 --- a/spec/mysql2/client_spec.rb +++ b/spec/mysql2/client_spec.rb @@ -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';") - 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';") + @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