2019-05-01 14:53:03 +01:00
|
|
|
# Overide by OS
|
|
|
|
service_name = 'postgresql'
|
2019-05-02 01:29:47 +01:00
|
|
|
pg_port = 5432
|
2019-05-01 14:53:03 +01:00
|
|
|
if os[:name] == 'centos' and os[:release].start_with?('6')
|
|
|
|
service_name = 'postgresql-9.6'
|
2019-05-02 01:29:47 +01:00
|
|
|
elsif os[:family] == 'debian' or os[:name] == 'suse'
|
|
|
|
pg_port = 5433
|
2019-05-01 14:53:03 +01:00
|
|
|
end
|
|
|
|
|
2019-05-02 01:29:47 +01:00
|
|
|
# Temporary `if` due to `opensuse-leap-15` bug re: `service`
|
|
|
|
if os[:name] == 'suse'
|
|
|
|
puts "[Skip `service`-based tests due to `opensuse-leap-15` detection bug (see https://github.com/inspec/train/issues/377)]"
|
|
|
|
puts "[Skip `service`-based tests due to `opensuse-leap-15` bug]"
|
|
|
|
else
|
2019-04-25 03:01:31 +01:00
|
|
|
control 'Postgres service' do
|
|
|
|
impact 0.5
|
|
|
|
title 'should be running and enabled'
|
|
|
|
|
2019-05-01 14:53:03 +01:00
|
|
|
describe service(service_name) do
|
2019-04-25 03:01:31 +01:00
|
|
|
it { should be_enabled }
|
|
|
|
it { should be_running }
|
|
|
|
end
|
|
|
|
|
2019-05-02 01:29:47 +01:00
|
|
|
describe port(pg_port) do
|
2019-04-25 03:01:31 +01:00
|
|
|
it { should be_listening }
|
|
|
|
end
|
|
|
|
end
|
2019-05-02 01:29:47 +01:00
|
|
|
end
|