Skip to content
Snippets Groups Projects
Commit ee5a182d authored by Ian Baum's avatar Ian Baum
Browse files

Merge branch 'improve-pgbouncer-running-check' into 'master'

Improve pgbouncer running? method

See merge request gitlab-org/omnibus-gitlab!4557
parents 24324300 451eb36e
No related branches found
No related tags found
No related merge requests found
---
title: Improve pgbouncer running? method
merge_request: 4557
author:
type: fixed
Loading
Loading
@@ -93,6 +93,7 @@ execute 'generate databases.ini' do
node['consul']['watchers'].include?('postgresql') &&
File.exist?(node['gitlab']['pgbouncer']['databases_ini'])
end
retries 3
end
 
execute 'reload pgbouncer' do
Loading
Loading
Loading
Loading
@@ -105,7 +105,9 @@ module Pgbouncer
end
 
def running?
GitlabCtl::Util.run_command('gitlab-ctl status pgbouncer').error?
true if show_databases
rescue GitlabCtl::Errors::ExecutionError
false
end
 
def database_paused?
Loading
Loading
Loading
Loading
@@ -97,4 +97,24 @@ RSpec.describe Pgbouncer::Databases do
)
end
end
context 'with pgbouncer listening' do
before do
allow(@obj).to receive(:show_databases).and_return("nyan")
end
it 'should be running' do
expect(@obj.running?).to be true
end
end
context 'with pgbouncer not listening' do
before do
allow(@obj).to receive(:show_databases).and_raise(GitlabCtl::Errors::ExecutionError.new("nya", "nya", "neko"))
end
it 'should not be running' do
expect(@obj.running?).to be false
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment