From 6a68ec9f7915ae2e32137e716320bdde046278a0 Mon Sep 17 00:00:00 2001 From: adrianiurca Date: Wed, 11 Aug 2021 15:57:07 +0300 Subject: [PATCH 1/2] update spec tests --- spec/spec_helper_local.rb | 4 ++++ spec/unit/classes/server/config_spec.rb | 8 ++++---- spec/unit/defines/server/default_privileges_spec.rb | 1 - spec/unit/defines/server/extension_spec.rb | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/spec/spec_helper_local.rb b/spec/spec_helper_local.rb index 0137edd85b..5f8a79987e 100644 --- a/spec/spec_helper_local.rb +++ b/spec/spec_helper_local.rb @@ -44,6 +44,10 @@ def param(type, title, param) param_value(catalogue, type, title, param) end +def postgresql_version + '9.6' +end + shared_examples 'postgresql_password function' do it { is_expected.not_to eq(nil) } diff --git a/spec/unit/classes/server/config_spec.rb b/spec/unit/classes/server/config_spec.rb index 1e413b08d2..a1ce20efab 100644 --- a/spec/unit/classes/server/config_spec.rb +++ b/spec/unit/classes/server/config_spec.rb @@ -32,7 +32,7 @@ end it 'has SELinux port defined' do - is_expected.to contain_package('policycoreutils-python') .with(ensure: 'present') + is_expected.to contain_package('policycoreutils-python').with(ensure: 'installed') is_expected.to contain_exec('/usr/sbin/semanage port -a -t postgresql_port_t -p tcp 5432') .with(unless: '/usr/sbin/semanage port -l | grep -qw 5432') @@ -141,7 +141,7 @@ class { 'postgresql::server': } end it 'has SELinux port defined' do - is_expected.to contain_package('policycoreutils-python-utils') .with(ensure: 'present') + is_expected.to contain_package('policycoreutils-python-utils').with(ensure: 'installed') is_expected.to contain_exec('/usr/sbin/semanage port -a -t postgresql_port_t -p tcp 5432') .with(unless: '/usr/sbin/semanage port -l | grep -qw 5432') @@ -214,7 +214,7 @@ class { 'postgresql::server': } end it 'has SELinux port defined' do - is_expected.to contain_package('policycoreutils-python-utils') .with(ensure: 'present') + is_expected.to contain_package('policycoreutils-python-utils').with(ensure: 'installed') is_expected.to contain_exec('/usr/sbin/semanage port -a -t postgresql_port_t -p tcp 5432') .with(unless: '/usr/sbin/semanage port -l | grep -qw 5432') @@ -282,7 +282,7 @@ class { 'postgresql::server': } end it 'has SELinux port defined' do - is_expected.to contain_package('policycoreutils') .with(ensure: 'present') + is_expected.to contain_package('policycoreutils').with(ensure: 'installed') is_expected.to contain_exec('/usr/sbin/semanage port -a -t postgresql_port_t -p tcp 5432') .with(unless: '/usr/sbin/semanage port -l | grep -qw 5432') diff --git a/spec/unit/defines/server/default_privileges_spec.rb b/spec/unit/defines/server/default_privileges_spec.rb index df8abf5b01..df5e5d0ff6 100644 --- a/spec/unit/defines/server/default_privileges_spec.rb +++ b/spec/unit/defines/server/default_privileges_spec.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require 'spec_helper' -require 'spec_helper_acceptance' describe 'postgresql::server::default_privileges', type: :define do let :facts do diff --git a/spec/unit/defines/server/extension_spec.rb b/spec/unit/defines/server/extension_spec.rb index 6c889601c0..04899982cd 100644 --- a/spec/unit/defines/server/extension_spec.rb +++ b/spec/unit/defines/server/extension_spec.rb @@ -54,7 +54,7 @@ it { is_expected.to contain_package('postgis') - .with(ensure: 'present', name: 'postgis').that_comes_before('Postgresql_psql[template_postgis: CREATE EXTENSION "postgis"]') + .with(ensure: 'installed', name: 'postgis').that_comes_before('Postgresql_psql[template_postgis: CREATE EXTENSION "postgis"]') } end @@ -86,7 +86,7 @@ it { is_expected.to contain_package('postgis') - .with(ensure: 'present', name: 'postgis').that_requires('Postgresql_psql[template_postgis: DROP EXTENSION "postgis"]') + .with(ensure: 'installed', name: 'postgis').that_requires('Postgresql_psql[template_postgis: DROP EXTENSION "postgis"]') } end end From 7a68dcd32de27ad811a5ecb7e9ce271514d9e120 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Sun, 15 Aug 2021 19:26:19 +0200 Subject: [PATCH 2/2] Remove accidentially added method --- spec/spec_helper_local.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/spec/spec_helper_local.rb b/spec/spec_helper_local.rb index 5f8a79987e..0137edd85b 100644 --- a/spec/spec_helper_local.rb +++ b/spec/spec_helper_local.rb @@ -44,10 +44,6 @@ def param(type, title, param) param_value(catalogue, type, title, param) end -def postgresql_version - '9.6' -end - shared_examples 'postgresql_password function' do it { is_expected.not_to eq(nil) }