From ee431f3cd1153c7a1db51ae8fcbfee1bdee88a51 Mon Sep 17 00:00:00 2001 From: jonathannewman Date: Thu, 15 Feb 2024 11:13:25 -0800 Subject: [PATCH] (maint) resolve test changes from updating postgresql module --- spec/acceptance/standalone_spec.rb | 3 +-- spec/support/acceptance/shared/puppetdb.rb | 12 ------------ spec/support/unit/shared/database.rb | 4 ++-- spec/unit/classes/database/postgresql_spec.rb | 2 +- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/spec/acceptance/standalone_spec.rb b/spec/acceptance/standalone_spec.rb index 3c2a31f1..f1b4d25e 100644 --- a/spec/acceptance/standalone_spec.rb +++ b/spec/acceptance/standalone_spec.rb @@ -6,8 +6,7 @@ let(:puppetdb_params) {} let(:puppetdb_master_config_params) {} - # TODO: temporary work-around for EL installs - let(:postgres_version) { "(getvar('facts.os.family') == 'RedHat') ? { true => '12', default => undef }" } + let(:postgres_version) { 'undef' } # default let(:manage_firewall) { "(getvar('facts.os.family') == 'RedHat' and Integer(getvar('facts.os.release.major')) > 7)" } describe 'with defaults' do diff --git a/spec/support/acceptance/shared/puppetdb.rb b/spec/support/acceptance/shared/puppetdb.rb index 20fac66b..e269ea4c 100644 --- a/spec/support/acceptance/shared/puppetdb.rb +++ b/spec/support/acceptance/shared/puppetdb.rb @@ -3,19 +3,7 @@ shared_examples 'puppetdb' do let(:pp) do <<~PP - # FIXME: temporary work-around for EL installs if $facts['os']['family'] == 'RedHat' { - $gpg_key_file = $facts['os']['release']['major'] ? { - '7' => 'PGDG-RPM-GPG-KEY-RHEL7', - default => 'PGDG-RPM-GPG-KEY-RHEL', - } - file { "/etc/pki/rpm-gpg/${gpg_key_file}": - source => "https://download.postgresql.org/pub/repos/yum/keys/${gpg_key_file}", - } - -> Yumrepo <| tag == 'postgresql::repo' |> { - gpgkey => "file:///etc/pki/rpm-gpg/${gpg_key_file}", - } - # Work-around EL systemd in docker bug affecting forked services file_line { 'puppetdb-unit-remove-pidfile': path => '/lib/systemd/system/puppetdb.service', diff --git a/spec/support/unit/shared/database.rb b/spec/support/unit/shared/database.rb index 5be30e9a..03a04388 100644 --- a/spec/support/unit/shared/database.rb +++ b/spec/support/unit/shared/database.rb @@ -220,14 +220,14 @@ end shared_examples 'puppetdb::database::postgresql_ssl_rules' do |error| - let(:defaults) { {} } + let(:defaults) { { postgres_version: '14' } } let(:with) { defined?(args) ? defaults.merge(args) : defaults } if error it { is_expected.to raise_error(error) } else let(:identity_map_key) { "#{with[:database_name]}-#{with[:database_username]}-map" } - let(:client_cert) { (with[:postgres_version].to_f >= 12.0) ? 'verify-full' : '1' } + let(:client_cert) { with[:postgres_version].to_f < 12 ? '1' : 'verify-full' } it { is_expected.to contain_puppetdb__database__postgresql_ssl_rules(name).with(with) } diff --git a/spec/unit/classes/database/postgresql_spec.rb b/spec/unit/classes/database/postgresql_spec.rb index e1e4e104..1b89b258 100644 --- a/spec/unit/classes/database/postgresql_spec.rb +++ b/spec/unit/classes/database/postgresql_spec.rb @@ -94,7 +94,7 @@ { read_database_username: params[:read_database_username], database_name: params[:database_name], - password_hash: 'md588e898a4bade3fe1c9b96f650ec85900', # TODO: mock properly + password_hash: %r{^(md5|SCRAM)}, # TODO: mock properly database_owner: params[:database_username], } end