-
Notifications
You must be signed in to change notification settings - Fork 227
Ruby integration tests #147
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
Conversation
tests/ruby/misc_spec.rb
Outdated
describe "Miscellaneous" do | ||
let(:proxies) { Helpers::Pgcat.single_shard_setup("sharded_db", 5) } | ||
|
||
describe "Clients closing connection in the middle of transaction" do | ||
it "sends a rollback to the server" do | ||
conn = PG::connect(proxies.main.connection_string("sharded_db", "sharding_user")) | ||
conn.async_exec("SET SERVER ROLE to 'primary'") | ||
conn.async_exec("BEGIN") | ||
proxies.primary.begin_counting_queries | ||
conn.close | ||
sleep 0.5 | ||
# ROLLBACK, DISCARD ALL, SET application_name | ||
expect(proxies.primary.end_counting_queries).to eq(3) | ||
end | ||
end |
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.
This would be difficult to verify by looking at stats or logs of the main process because we don't increment stats for recovery ROLLBACK
.
Putting another proxy between the database and pgcat and inspecting its logs will give us an idea what is actually being sent by the main Pgcat process
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.
Sweet!
Exit with failure codes if configs are bad (postgresml#146) Move autoreloader to own tokio task (postgresml#148) Ruby integration tests (postgresml#147) Allow running integration tests with coverage locally (postgresml#151) Log Address information in connection create/drop (postgresml#154) Better handling for checkout errors during extended protocol messages (postgresml#155)
We use 4 separate instances of Postgres and use
pg_stat_statements
to validate Pgcat's routing decisions.This contains some convenience classes that allows us to control the Pgcat process under test, apply toxics to communication with database and count queries on Postgres side.