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