test(inspec): move common controls to the share profile

This commit is contained in:
Imran Iqbal
2021-07-20 18:01:37 +01:00
parent 27473b9865
commit 2214096362
6 changed files with 73 additions and 8 deletions

View File

@@ -0,0 +1,18 @@
# frozen_string_literal: true
# Overide by Platform
pg_port = '5432'
pg_port = '5433' if (platform[:family] == 'debian') || (platform[:family] == 'suse')
control 'Postgres command' do
title 'should match desired lines'
# Can't use `%Q` here due to the `\`
describe command("su - postgres -c 'psql -p#{pg_port} -qtc \"\\l+ db2\"'") do
its(:stdout) do
should match(
/db2.*remoteUser.*UTF8.*en_US.UTF-8.*en_US.UTF-8.*my_space/
)
end
end
end

View File

@@ -0,0 +1,12 @@
# frozen_string_literal: true
control 'Postgres configuration' do
title 'should include the directory'
describe file('/srv/my_tablespace') do
it { should be_directory }
it { should be_owned_by 'postgres' }
it { should be_grouped_into 'postgres' }
its('mode') { should cmp '0700' }
end
end