diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 00000000..6ce4d1a1 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,10 @@ +require: + - cookstyle + +AllCops: + TargetRubyVersion: 3.1 + Include: + - "**/*.rb" + Exclude: + - "vendor/**/*" + - "spec/**/*" diff --git a/kitchen.yml b/kitchen.yml index 5959eb87..61f3818c 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -16,22 +16,16 @@ verifier: name: inspec platforms: - - name: almalinux-8 - name: almalinux-9 - - name: amazonlinux-2 - - name: centos-7 - - name: centos-stream-8 + - name: rockylinux-9 + - name: oraclelinux-9 - name: centos-stream-9 - - name: debian-10 + - name: amazonlinux-2 - name: debian-11 - name: debian-12 - name: fedora-latest - - name: oraclelinux-7 - - name: oraclelinux-8 - - name: rockylinux-8 - - name: rockylinux-9 - - name: ubuntu-20.04 - name: ubuntu-22.04 + - name: ubuntu-24.04 suites: - name: server_install_os @@ -41,282 +35,215 @@ suites: run_list: - recipe[test::server_install_os] - - name: access_15 + # PostgreSQL 17 + - name: access_17 attributes: test: - pg_ver: "15" + pg_ver: "17" verifier: inspec_tests: - path: test/integration/access/ run_list: - recipe[test::access] - - name: client_install_15 + - name: client_install_17 attributes: test: - pg_ver: "15" + pg_ver: "17" verifier: inspec_tests: - path: test/integration/client_install/ inputs: - pg_ver: "15" + pg_ver: "17" run_list: - recipe[test::client_install] - - name: extension_15 + - name: extension_17 attributes: test: - pg_ver: "15" + pg_ver: "17" verifier: inspec_tests: - path: test/integration/extension/ run_list: - recipe[test::extension] - - name: ident_15 + - name: ident_17 attributes: test: - pg_ver: "15" + pg_ver: "17" verifier: inspec_tests: - path: test/integration/ident/ run_list: - recipe[test::ident] - - name: initdb_locale_15 + - name: initdb_locale_17 attributes: test: - pg_ver: "15" + pg_ver: "17" verifier: inspec_tests: - path: test/integration/initdb_locale/ run_list: - recipe[test::initdb_locale] - - name: repo_15 + - name: repo_17 attributes: test: - pg_ver: "15" + pg_ver: "17" verifier: inspec_tests: - path: test/integration/repo/ inputs: - pg_ver: "15" + pg_ver: "17" run_list: - recipe[test::repository] - - name: server_install_15 + - name: server_install_17 attributes: test: - pg_ver: "15" + pg_ver: "17" verifier: inspec_tests: - path: test/integration/server_install/ inputs: - pg_ver: "15" + pg_ver: "17" run_list: - recipe[test::server_install] - - name: access_14 + # PostgreSQL 16 + - name: access_16 attributes: test: - pg_ver: "14" + pg_ver: "16" verifier: inspec_tests: - path: test/integration/access/ run_list: - recipe[test::access] - - name: client_install_14 + - name: client_install_16 attributes: test: - pg_ver: "14" + pg_ver: "16" verifier: inspec_tests: - path: test/integration/client_install/ inputs: - pg_ver: "14" + pg_ver: "16" run_list: - recipe[test::client_install] - - name: extension_14 + - name: extension_16 attributes: test: - pg_ver: "14" + pg_ver: "16" verifier: inspec_tests: - path: test/integration/extension/ run_list: - recipe[test::extension] - - name: ident_14 + - name: ident_16 attributes: test: - pg_ver: "14" + pg_ver: "16" verifier: inspec_tests: - path: test/integration/ident/ run_list: - recipe[test::ident] - - name: initdb_locale_14 + - name: initdb_locale_16 attributes: test: - pg_ver: "14" + pg_ver: "16" verifier: inspec_tests: - path: test/integration/initdb_locale/ run_list: - recipe[test::initdb_locale] - - name: repo_14 + - name: repo_16 attributes: test: - pg_ver: "14" + pg_ver: "16" verifier: inspec_tests: - path: test/integration/repo/ inputs: - pg_ver: "14" + pg_ver: "16" run_list: - recipe[test::repository] - - name: server_install_14 + - name: server_install_16 attributes: test: - pg_ver: "14" + pg_ver: "16" verifier: inspec_tests: - path: test/integration/server_install/ inputs: - pg_ver: "14" + pg_ver: "16" run_list: - recipe[test::server_install] - - name: access_13 - attributes: - test: - pg_ver: "13" - verifier: - inspec_tests: - - path: test/integration/access/ - run_list: - - recipe[test::access] - - name: client_install_13 - attributes: - test: - pg_ver: "13" - verifier: - inspec_tests: - - path: test/integration/client_install/ - inputs: - pg_ver: "13" - run_list: - - recipe[test::client_install] - - name: extension_13 - attributes: - test: - pg_ver: "13" - verifier: - inspec_tests: - - path: test/integration/extension/ - run_list: - - recipe[test::extension] - - name: ident_13 - attributes: - test: - pg_ver: "13" - verifier: - inspec_tests: - - path: test/integration/ident/ - run_list: - - recipe[test::ident] - - name: initdb_locale_13 - attributes: - test: - pg_ver: "13" - verifier: - inspec_tests: - - path: test/integration/initdb_locale/ - run_list: - - recipe[test::initdb_locale] - - name: repo_13 - attributes: - test: - pg_ver: "13" - verifier: - inspec_tests: - - path: test/integration/repo/ - inputs: - pg_ver: "13" - run_list: - - recipe[test::repository] - - name: server_install_13 - attributes: - test: - pg_ver: "13" - verifier: - inspec_tests: - - path: test/integration/server_install/ - inputs: - pg_ver: "13" - run_list: - - recipe[test::server_install] - - - name: access_12 + # PostgreSQL 15 + - name: access_15 attributes: test: - pg_ver: "12" + pg_ver: "15" verifier: inspec_tests: - path: test/integration/access/ run_list: - recipe[test::access] - - name: client_install_12 + - name: client_install_15 attributes: test: - pg_ver: "12" + pg_ver: "15" verifier: inspec_tests: - path: test/integration/client_install/ inputs: - pg_ver: "12" + pg_ver: "15" run_list: - recipe[test::client_install] - - name: extension_12 + - name: extension_15 attributes: test: - pg_ver: "12" + pg_ver: "15" verifier: inspec_tests: - path: test/integration/extension/ run_list: - recipe[test::extension] - - name: ident_12 + - name: ident_15 attributes: test: - pg_ver: "12" + pg_ver: "15" verifier: inspec_tests: - path: test/integration/ident/ run_list: - recipe[test::ident] - - name: initdb_locale_12 + - name: initdb_locale_15 attributes: test: - pg_ver: "12" + pg_ver: "15" verifier: inspec_tests: - path: test/integration/initdb_locale/ run_list: - recipe[test::initdb_locale] - - name: repo_12 + - name: repo_15 attributes: test: - pg_ver: "12" + pg_ver: "15" verifier: inspec_tests: - path: test/integration/repo/ inputs: - pg_ver: "12" + pg_ver: "15" run_list: - recipe[test::repository] - - name: server_install_12 + - name: server_install_15 attributes: test: - pg_ver: "12" + pg_ver: "15" verifier: inspec_tests: - path: test/integration/server_install/ inputs: - pg_ver: "12" + pg_ver: "15" run_list: - recipe[test::server_install] diff --git a/libraries/helpers.rb b/libraries/helpers.rb index 152f08f2..b8794933 100644 --- a/libraries/helpers.rb +++ b/libraries/helpers.rb @@ -112,12 +112,12 @@ def default_server_packages(version: nil, source: :os) case node['platform_family'] when 'rhel', 'fedora', 'amazon' { - os: %w(postgresql-contrib postgresql-server), + os: %w(libpq postgresql-contrib postgresql-server), repo: %W(postgresql#{version.delete('.')}-contrib postgresql#{version.delete('.')}-server), }.fetch(source, nil) when 'debian' { - os: %w(postgresql postgresql-common), + os: %w(libpq5 postgresql postgresql-common), repo: %W(postgresql-#{version} postgresql-common), }.fetch(source, nil) end diff --git a/test/cookbooks/test/recipes/client_install.rb b/test/cookbooks/test/recipes/client_install.rb index 745759ee..7d0a0fa2 100644 --- a/test/cookbooks/test/recipes/client_install.rb +++ b/test/cookbooks/test/recipes/client_install.rb @@ -1,3 +1,13 @@ +# frozen_string_literal: true + +# Import PostgreSQL GPG key +execute 'import_pgdg_key' do + command 'rpm --import https://download.postgresql.org/pub/repos/yum/RPM-GPG-KEY-PGDG' + not_if 'rpm -q gpg-pubkey-08b40d20-*' +end + +include_recipe 'test::dokken' + postgresql_install 'postgresql' do version node['test']['pg_ver'] diff --git a/test/cookbooks/test/recipes/dokken.rb b/test/cookbooks/test/recipes/dokken.rb new file mode 100644 index 00000000..c7e1d617 --- /dev/null +++ b/test/cookbooks/test/recipes/dokken.rb @@ -0,0 +1 @@ +package 'libpq' diff --git a/test/cookbooks/test/recipes/server_install_os.rb b/test/cookbooks/test/recipes/server_install_os.rb index de052a94..35fc5ce1 100644 --- a/test/cookbooks/test/recipes/server_install_os.rb +++ b/test/cookbooks/test/recipes/server_install_os.rb @@ -1,3 +1,15 @@ +# STDERR: Importing GPG key 0x08B40D20: +# Userid : "PostgreSQL RPM Repository " +# Fingerprint: D4BF 08AE 67A0 B4C7 A1DB CCD2 40BC A2B4 08B4 0D20 +# From : /etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY +# Public key for postgresql17-17.0-2PGDG.rhel9.aarch64.rpm is not installed. Failing package is: postgresql17-17.0-2PGDG.rhel9.aarch64 +# GPG Keys are configured as: file:///etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY +# Public key for postgresql17-libs-17.0-2PGDG.rhel9.aarch64.rpm is not installed. Failing package is: postgresql17-libs-17.0-2PGDG.rhel9.aarch64 +# GPG Keys are configured as: file:///etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY +# Error: GPG check FAILED +# ---- End output of ["dnf", "-y", "install", "postgresql17-0:17.0-2PGDG.rhel9.aarch64"] ---- +# Ran ["dnf", "-y", "install", "postgresql17-0:17.0-2PGDG.rhel9.aarch64"] returned 1 + postgresql_install 'postgresql' do source :os action %i(install init_server)