Merge pull request #6798 from betagouv/make_ping_work_again
Corrige le controller ping (health check)
This commit is contained in:
commit
a009871ec1
2 changed files with 3 additions and 3 deletions
|
@ -4,7 +4,7 @@ class PingController < ApplicationController
|
|||
status_code = if File.file?(Rails.root.join("maintenance"))
|
||||
# See https://cbonte.github.io/haproxy-dconv/2.0/configuration.html#4.2-http-check%20disable-on-404
|
||||
:not_found
|
||||
elsif (ActiveRecord::Base.connected?)
|
||||
elsif (ActiveRecord::Base.connection.execute('select 1 as test;').first['test'] == 1)
|
||||
:ok
|
||||
else
|
||||
:internal_server_error
|
||||
|
|
|
@ -6,10 +6,10 @@ describe PingController, type: :controller do
|
|||
|
||||
context 'when base is un-plug' do
|
||||
before do
|
||||
allow(ActiveRecord::Base).to receive(:connected?).and_return(false)
|
||||
allow(ActiveRecord::Base).to receive(:connected?).and_raise(ActiveRecord::ConnectionTimeoutError)
|
||||
end
|
||||
|
||||
it { expect(subject.status).to eq 500 }
|
||||
it { expect { subject }.to raise_error(ActiveRecord::ConnectionTimeoutError) }
|
||||
end
|
||||
|
||||
context 'when a maintenance file is present' do
|
||||
|
|
Loading…
Reference in a new issue