Skip to content

Fix spec tests #1323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 27 additions & 24 deletions spec/classes/server/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,34 +216,37 @@ class { 'postgresql::server':
describe 'on Gentoo' do
include_examples 'Gentoo'

let(:pre_condition) do
<<-EOS
class { 'postgresql::globals':
version => '9.5',
}->
class { 'postgresql::server': }
EOS
end
describe 'with systemd' do
let(:facts) { super().merge(service_provider: 'systemd') }
let(:pre_condition) do
<<-EOS
class { 'postgresql::globals':
version => '9.5',
}->
class { 'postgresql::server': }
EOS
end

it 'does not have SELinux port defined' do
is_expected.not_to contain_exec('/usr/sbin/semanage port -a -t postgresql_port_t -p tcp 5432')
end
it 'does not have SELinux port defined' do
is_expected.not_to contain_exec('/usr/sbin/semanage port -a -t postgresql_port_t -p tcp 5432')
end

it 'removes the old systemd-override file' do
is_expected.to contain_file('old-systemd-override')
.with(ensure: 'absent', path: '/etc/systemd/system/postgresql-9.5.service')
end
it 'removes the old systemd-override file' do
is_expected.to contain_file('old-systemd-override')
.with(ensure: 'absent', path: '/etc/systemd/system/postgresql-9.5.service')
end

it 'has the correct systemd-override drop file' do
is_expected.to contain_file('systemd-override').with(
ensure: 'file', path: '/etc/systemd/system/postgresql-9.5.service.d/postgresql-9.5.conf',
owner: 'root', group: 'root'
)
end
it 'has the correct systemd-override drop file' do
is_expected.to contain_file('systemd-override').with(
ensure: 'file', path: '/etc/systemd/system/postgresql-9.5.service.d/postgresql-9.5.conf',
owner: 'root', group: 'root'
)
end

it 'has the correct systemd-override file #regex' do
is_expected.to contain_file('systemd-override') \
.with_content(%r{(?!^.include)})
it 'has the correct systemd-override file #regex' do
is_expected.to contain_file('systemd-override') \
.with_content(%r{(?!^.include)})
end
end
end
end
5 changes: 3 additions & 2 deletions spec/classes/server/contrib_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@
describe 'on Gentoo' do
include_examples 'Gentoo'

it 'fails to compile' do
is_expected.to compile.and_raise_error(%r{is not supported})
it 'postgresql-contrib should not be installed' do
is_expected.to compile
is_expected.not_to contain_package('postgresql-contrib')
end
end

Expand Down