Ensure we clean up state in PostgreSQL failover specs.
This commit is contained in:
parent
a173511681
commit
94782152c6
|
@ -89,6 +89,7 @@ describe ActiveRecord::ConnectionHandling do
|
||||||
expect(Sidekiq.paused?).to eq(true)
|
expect(Sidekiq.paused?).to eq(true)
|
||||||
|
|
||||||
with_multisite_db(multisite_db) do
|
with_multisite_db(multisite_db) do
|
||||||
|
begin
|
||||||
expect(postgresql_fallback_handler.master_down?).to eq(nil)
|
expect(postgresql_fallback_handler.master_down?).to eq(nil)
|
||||||
|
|
||||||
message = MessageBus.track_publish(PostgreSQLFallbackHandler::DATABASE_DOWN_CHANNEL) do
|
message = MessageBus.track_publish(PostgreSQLFallbackHandler::DATABASE_DOWN_CHANNEL) do
|
||||||
|
@ -102,9 +103,10 @@ describe ActiveRecord::ConnectionHandling do
|
||||||
.to change { Discourse.readonly_mode? }.from(false).to(true)
|
.to change { Discourse.readonly_mode? }.from(false).to(true)
|
||||||
|
|
||||||
expect(postgresql_fallback_handler.master_down?).to eq(true)
|
expect(postgresql_fallback_handler.master_down?).to eq(true)
|
||||||
end
|
ensure
|
||||||
|
|
||||||
postgresql_fallback_handler.master_up(multisite_db)
|
postgresql_fallback_handler.master_up(multisite_db)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
ActiveRecord::Base.unstub(:postgresql_connection)
|
ActiveRecord::Base.unstub(:postgresql_connection)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue