Fix randomly failing spec on Travis.

This commit is contained in:
Guo Xiang Tan 2017-10-26 16:37:41 +08:00
parent 8b12a906c6
commit b636e858bb
1 changed files with 2 additions and 5 deletions

View File

@ -105,21 +105,18 @@ describe ActiveRecord::ConnectionHandling do
expect(postgresql_fallback_handler.master_down?).to eq(true) expect(postgresql_fallback_handler.master_down?).to eq(true)
ensure ensure
postgresql_fallback_handler.master_up(multisite_db) postgresql_fallback_handler.master_up(multisite_db)
expect(postgresql_fallback_handler.master_down?).to eq(nil)
end end
end end
expect(postgresql_fallback_handler.masters_down.hash).to eq(
"default" => true
)
ActiveRecord::Base.unstub(:postgresql_connection) ActiveRecord::Base.unstub(:postgresql_connection)
postgresql_fallback_handler.initiate_fallback_to_master postgresql_fallback_handler.initiate_fallback_to_master
expect(Discourse.readonly_mode?).to eq(false) expect(Discourse.readonly_mode?).to eq(false)
expect(postgresql_fallback_handler.masters_down.hash).to eq({})
expect(Sidekiq.paused?).to eq(false) expect(Sidekiq.paused?).to eq(false)
expect(ActiveRecord::Base.connection_pool.connections.count).to eq(0) expect(ActiveRecord::Base.connection_pool.connections.count).to eq(0)
expect(postgresql_fallback_handler.master_down?).to eq(nil)
expect(ActiveRecord::Base.connection) expect(ActiveRecord::Base.connection)
.to be_an_instance_of(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) .to be_an_instance_of(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)