From a1033e91bdd2ebd0b53f2066ef2afcc555d405c3 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Sun, 6 Feb 2022 16:27:40 +0100 Subject: [PATCH] Fix spec tests In a bad rebase I introduced a test failure. Fixes: f4a42a7d788a4d04fcf56a8c397a851e0e081c57 --- spec/classes/server/config_spec.rb | 51 +++++++++++++++-------------- spec/classes/server/contrib_spec.rb | 5 +-- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/spec/classes/server/config_spec.rb b/spec/classes/server/config_spec.rb index 55fbf665ce..25a724814e 100644 --- a/spec/classes/server/config_spec.rb +++ b/spec/classes/server/config_spec.rb @@ -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 diff --git a/spec/classes/server/contrib_spec.rb b/spec/classes/server/contrib_spec.rb index 4092801c30..dcbda7b5bf 100644 --- a/spec/classes/server/contrib_spec.rb +++ b/spec/classes/server/contrib_spec.rb @@ -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