Merge pull request #5207 from tgxworld/try_travis_fix

Fix randomly failing test.
This commit is contained in:
Guo Xiang Tan 2017-09-28 10:56:05 +08:00 committed by GitHub
commit 3e6bf38394
4 changed files with 6 additions and 20 deletions

View File

@ -3,7 +3,7 @@ development:
adapter: postgresql adapter: postgresql
database: <%= ENV['DISCOURSE_DEV_DB'] || 'discourse_development' %> database: <%= ENV['DISCOURSE_DEV_DB'] || 'discourse_development' %>
min_messages: warning min_messages: warning
pool: 10 pool: 5
timeout: 5000 timeout: 5000
host_names: host_names:
### Don't include the port number here. Change the "port" site setting instead, at /admin/site_settings. ### Don't include the port number here. Change the "port" site setting instead, at /admin/site_settings.
@ -20,7 +20,7 @@ test:
adapter: postgresql adapter: postgresql
database: discourse_test<%= ENV['MULTISITE'] ? "_#{ENV['MULTISITE']}" : '' %> database: discourse_test<%= ENV['MULTISITE'] ? "_#{ENV['MULTISITE']}" : '' %>
min_messages: warning min_messages: warning
pool: 10 pool: 5
timeout: 5000 timeout: 5000
host_names: host_names:
- test.localhost - test.localhost

View File

@ -1,6 +1,6 @@
--- ---
development: development:
:concurrency: 5 :concurrency: 1
:queues: :queues:
- [critical,4] - [critical,4]
- [default, 2] - [default, 2]

View File

@ -119,14 +119,7 @@ module ActiveRecord
def verify_replica(connection) def verify_replica(connection)
value = connection.raw_connection.exec("SELECT pg_is_in_recovery()").values[0][0] value = connection.raw_connection.exec("SELECT pg_is_in_recovery()").values[0][0]
raise "Replica database server is not in recovery mode." if !value
if !value
begin
raise "Replica database server is not in recovery mode."
ensure
connection.close
end
end
end end
end end
end end

View File

@ -94,15 +94,8 @@ describe ActiveRecord::ConnectionHandling do
expect(postgresql_fallback_handler.master_down?).to eq(nil) expect(postgresql_fallback_handler.master_down?).to eq(nil)
expect(ActiveRecord::Base.connection_pool.connections.count).to eq(0) expect(ActiveRecord::Base.connection_pool.connections.count).to eq(0)
ActiveRecord::Base.clear_all_connections! expect(ActiveRecord::Base.connection)
connection = ActiveRecord::Base.connection .to be_an_instance_of(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
begin
expect(connection)
.to be_an_instance_of(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
ensure
connection.close
end
end end
end end