From d7d6ac9208335eeddec55e67f9738865285b120d Mon Sep 17 00:00:00 2001 From: "Eric D. Helms" Date: Thu, 7 May 2020 08:22:08 -0400 Subject: [PATCH] Refs #29215: Add RHEL 8 to metadata and run tests on all OSes --- metadata.json | 3 +- spec/classes/certs_apache_spec.rb | 32 ++++++++------- spec/classes/certs_candlepin_spec.rb | 14 ++++--- .../certs_foreman_proxy_content_spec.rb | 34 +++++++++------- spec/classes/certs_foreman_proxy_spec.rb | 14 ++++--- spec/classes/certs_katello_spec.rb | 40 ++++++++++--------- spec/classes/certs_pulp_client_spec.rb | 14 ++++--- spec/classes/certs_puppet_spec.rb | 14 ++++--- spec/classes/certs_qpid_client_spec.rb | 8 ++-- spec/classes/certs_qpid_router_spec.rb | 14 ++++--- spec/classes/certs_qpid_spec.rb | 6 +-- spec/classes/certs_spec.rb | 16 ++++---- 12 files changed, 122 insertions(+), 87 deletions(-) diff --git a/metadata.json b/metadata.json index d0591396..377728be 100644 --- a/metadata.json +++ b/metadata.json @@ -35,7 +35,8 @@ { "operatingsystem": "RedHat", "operatingsystemrelease": [ - "7" + "7", + "8" ] }, { diff --git a/spec/classes/certs_apache_spec.rb b/spec/classes/certs_apache_spec.rb index 2d4187c4..b2b0218c 100644 --- a/spec/classes/certs_apache_spec.rb +++ b/spec/classes/certs_apache_spec.rb @@ -1,24 +1,28 @@ require 'spec_helper' describe 'certs::apache' do - let :facts do - on_supported_os['redhat-7-x86_64'] - end + on_supported_os.each do |os, os_facts| + context "on #{os}" do + let :facts do + os_facts + end - describe 'with default parameters' do - it { should compile.with_all_deps } - end + describe 'with default parameters' do + it { should compile.with_all_deps } + end - describe "with group overridden" do - let :pre_condition do - "class {'certs': group => 'foreman',}" - end + describe "with group overridden" do + let :pre_condition do + "class {'certs': group => 'foreman',}" + end - it { should compile.with_all_deps } + it { should compile.with_all_deps } - it do - is_expected.to contain_certs__keypair('apache') - .with_key_group('foreman') + it do + is_expected.to contain_certs__keypair('apache') + .with_key_group('foreman') + end + end end end end diff --git a/spec/classes/certs_candlepin_spec.rb b/spec/classes/certs_candlepin_spec.rb index dee66603..661bc7e4 100644 --- a/spec/classes/certs_candlepin_spec.rb +++ b/spec/classes/certs_candlepin_spec.rb @@ -1,11 +1,15 @@ require 'spec_helper' describe 'certs::candlepin' do - let :facts do - on_supported_os['redhat-7-x86_64'] - end + on_supported_os.each do |os, os_facts| + context "on #{os}" do + let :facts do + os_facts + end - describe 'with default parameters' do - it { should compile.with_all_deps } + describe 'with default parameters' do + it { should compile.with_all_deps } + end + end end end diff --git a/spec/classes/certs_foreman_proxy_content_spec.rb b/spec/classes/certs_foreman_proxy_content_spec.rb index 16d1ebda..e3968389 100644 --- a/spec/classes/certs_foreman_proxy_content_spec.rb +++ b/spec/classes/certs_foreman_proxy_content_spec.rb @@ -1,24 +1,28 @@ require 'spec_helper' describe 'certs::foreman_proxy_content' do - let :facts do - on_supported_os['redhat-7-x86_64'] - end + on_supported_os.each do |os, os_facts| + context "on #{os}" do + let :facts do + os_facts + end - describe 'with default parameters' do - let :params do - { - certs_tar: '/tmp/tar', - foreman_proxy_fqdn: 'bar.example.com' - } - end + describe 'with default parameters' do + let :params do + { + certs_tar: '/tmp/tar', + foreman_proxy_fqdn: 'bar.example.com' + } + end - it { should compile.with_all_deps } - end + it { should compile.with_all_deps } + end - context 'with empty certs_tar' do - let(:params) { { certs_tar: '' } } + context 'with empty certs_tar' do + let(:params) { { certs_tar: '' } } - it { should compile.and_raise_error(/\'certs_tar\' expects a Stdlib::Absolutepath/) } + it { should compile.and_raise_error(/\'certs_tar\' expects a Stdlib::Absolutepath/) } + end + end end end diff --git a/spec/classes/certs_foreman_proxy_spec.rb b/spec/classes/certs_foreman_proxy_spec.rb index befed1d4..d3ae9342 100644 --- a/spec/classes/certs_foreman_proxy_spec.rb +++ b/spec/classes/certs_foreman_proxy_spec.rb @@ -1,11 +1,15 @@ require 'spec_helper' describe 'certs::foreman_proxy' do - let :facts do - on_supported_os['redhat-7-x86_64'] - end + on_supported_os.each do |os, os_facts| + context "on #{os}" do + let :facts do + os_facts + end - describe 'with default parameters' do - it { should compile.with_all_deps } + describe 'with default parameters' do + it { should compile.with_all_deps } + end + end end end diff --git a/spec/classes/certs_katello_spec.rb b/spec/classes/certs_katello_spec.rb index 3859f10e..51bc3df9 100644 --- a/spec/classes/certs_katello_spec.rb +++ b/spec/classes/certs_katello_spec.rb @@ -1,27 +1,31 @@ require 'spec_helper' describe 'certs::katello' do - let :facts do - on_supported_os['redhat-7-x86_64'] - end + on_supported_os.each do |os, os_facts| + context "on #{os}" do + let :facts do + os_facts + end - context 'with parameters' do - let :pre_condition do - "class {'certs': pki_dir => '/tmp', server_ca_name => 'server_ca', default_ca_name => 'default_ca'}" - end + context 'with parameters' do + let :pre_condition do + "class {'certs': pki_dir => '/tmp', server_ca_name => 'server_ca', default_ca_name => 'default_ca'}" + end - it { should contain_trusted_ca__ca('katello_server-host-cert').with_source('/tmp/certs/server_ca.crt') } + it { should contain_trusted_ca__ca('katello_server-host-cert').with_source('/tmp/certs/server_ca.crt') } - it do - should contain_certs_bootstrap_rpm('katello-ca-consumer-foo.example.com') - .with_dir('/var/www/html/pub') - .with_summary('Subscription-manager consumer certificate for Katello instance foo.example.com') - .with_description('Consumer certificate and post installation script that configures rhsm.') - .with_files(['/usr/bin/katello-rhsm-consumer:755=/var/www/html/pub/katello-rhsm-consumer']) - .with_bootstrap_script('/bin/bash /usr/bin/katello-rhsm-consumer') - .with_postun_script("if [ $1 -eq 0 ]; then\ntest -f /etc/rhsm/rhsm.conf.kat-backup && command cp /etc/rhsm/rhsm.conf.kat-backup /etc/rhsm/rhsm.conf\nfi\n") - .with_alias('katello-ca-consumer-latest.noarch.rpm') - .that_subscribes_to(['Ca[server_ca]', 'Certs::Rhsm_reconfigure_script[/var/www/html/pub/katello-rhsm-consumer]']) + it do + should contain_certs_bootstrap_rpm('katello-ca-consumer-foo.example.com') + .with_dir('/var/www/html/pub') + .with_summary('Subscription-manager consumer certificate for Katello instance foo.example.com') + .with_description('Consumer certificate and post installation script that configures rhsm.') + .with_files(['/usr/bin/katello-rhsm-consumer:755=/var/www/html/pub/katello-rhsm-consumer']) + .with_bootstrap_script('/bin/bash /usr/bin/katello-rhsm-consumer') + .with_postun_script("if [ $1 -eq 0 ]; then\ntest -f /etc/rhsm/rhsm.conf.kat-backup && command cp /etc/rhsm/rhsm.conf.kat-backup /etc/rhsm/rhsm.conf\nfi\n") + .with_alias('katello-ca-consumer-latest.noarch.rpm') + .that_subscribes_to(['Ca[server_ca]', 'Certs::Rhsm_reconfigure_script[/var/www/html/pub/katello-rhsm-consumer]']) + end + end end end end diff --git a/spec/classes/certs_pulp_client_spec.rb b/spec/classes/certs_pulp_client_spec.rb index 59deb1b2..d6017725 100644 --- a/spec/classes/certs_pulp_client_spec.rb +++ b/spec/classes/certs_pulp_client_spec.rb @@ -1,11 +1,15 @@ require 'spec_helper' describe 'certs::pulp_client' do - let :facts do - on_supported_os['redhat-7-x86_64'] - end + on_supported_os.each do |os, os_facts| + context "on #{os}" do + let :facts do + os_facts + end - describe 'with default parameters' do - it { should compile.with_all_deps } + describe 'with default parameters' do + it { should compile.with_all_deps } + end + end end end diff --git a/spec/classes/certs_puppet_spec.rb b/spec/classes/certs_puppet_spec.rb index 88ff5dc3..34bedc3e 100644 --- a/spec/classes/certs_puppet_spec.rb +++ b/spec/classes/certs_puppet_spec.rb @@ -1,11 +1,15 @@ require 'spec_helper' describe 'certs::puppet' do - let :facts do - on_supported_os['redhat-7-x86_64'] - end + on_supported_os.each do |os, os_facts| + context "on #{os}" do + let :facts do + os_facts + end - describe 'with default parameters' do - it { should compile.with_all_deps } + describe 'with default parameters' do + it { should compile.with_all_deps } + end + end end end diff --git a/spec/classes/certs_qpid_client_spec.rb b/spec/classes/certs_qpid_client_spec.rb index 18dbd466..9d028182 100644 --- a/spec/classes/certs_qpid_client_spec.rb +++ b/spec/classes/certs_qpid_client_spec.rb @@ -1,9 +1,11 @@ require 'spec_helper' describe 'certs::qpid_client' do - on_supported_os.each do |os, facts| - context "on #{os}" do - let :facts do facts end + on_supported_os.each do |os, os_facts| + context "on #{os}", if: os_facts[:operatingsystemmajrelease] == '7' do + let :facts do + os_facts + end describe "with default parameters" do it { is_expected.to compile.with_all_deps } diff --git a/spec/classes/certs_qpid_router_spec.rb b/spec/classes/certs_qpid_router_spec.rb index a09c8089..8acf2f54 100644 --- a/spec/classes/certs_qpid_router_spec.rb +++ b/spec/classes/certs_qpid_router_spec.rb @@ -1,11 +1,15 @@ require 'spec_helper' describe 'certs::qpid_router' do - let :facts do - on_supported_os['redhat-7-x86_64'] - end + on_supported_os.each do |os, os_facts| + context "on #{os}", if: os_facts[:operatingsystemmajrelease] == '7' do + let :facts do + os_facts + end - describe 'with default parameters' do - it { should compile.with_all_deps } + describe 'with default parameters' do + it { should compile.with_all_deps } + end + end end end diff --git a/spec/classes/certs_qpid_spec.rb b/spec/classes/certs_qpid_spec.rb index 630f50e4..4f26aaf0 100644 --- a/spec/classes/certs_qpid_spec.rb +++ b/spec/classes/certs_qpid_spec.rb @@ -1,10 +1,10 @@ require 'spec_helper' describe 'certs::qpid' do - on_supported_os.each do |os, facts| - context "on #{os}" do + on_supported_os.each do |os, os_facts| + context "on #{os}", if: os_facts[:operatingsystemmajrelease] == '7' do let :facts do - facts + os_facts end describe "with default parameters" do diff --git a/spec/classes/certs_spec.rb b/spec/classes/certs_spec.rb index e334f978..13d30315 100644 --- a/spec/classes/certs_spec.rb +++ b/spec/classes/certs_spec.rb @@ -1,14 +1,14 @@ require 'spec_helper' describe 'certs' do - - context 'on redhat' do - let :facts do - on_supported_os['redhat-7-x86_64'] + on_supported_os.each do |os, os_facts| + context "on #{os}" do + let :facts do + os_facts + end + + it { should contain_class('certs::install') } + it { should contain_class('certs::config') } end - - it { should contain_class('certs::install') } - it { should contain_class('certs::config') } end - end