cartodb-4.29/spec/lib/initializers/zz_patch_reconnect_spec.rb

18 lines
581 B
Ruby
Raw Permalink Normal View History

2020-06-15 10:58:47 +08:00
require_relative '../../spec_helper_min'
describe ActiveRecord::ConnectionAdapters::PostgreSQLAdapter do
describe '#survive_failure' do
it 'Should survive a PostgreSQL disconnection' do
# We don't care about whether a visualization exists, we just want some activity
Carto::Visualization.first
# break the AR connection on purpose
expect {
ActiveRecord::Base.connection.exec_query("SELECT pg_terminate_backend(pg_backend_pid())")
}.to raise_exception(ActiveRecord::StatementInvalid)
Carto::Visualization.first
end
end
end