Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add rh_cloud acceptance test #1206

Merged
merged 3 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions spec/acceptance/foreman_cli_plugins_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ class { 'foreman::cli':
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
yumrepo { 'katello':
baseurl => "http://yum.theforeman.org/katello/nightly/katello/el${facts['os']['release']['major']}/x86_64/",
gpgcheck => 0,
}

class { 'foreman::cli':
foreman_url => 'https://foreman.example.com',
username => 'admin',
Expand All @@ -77,8 +72,6 @@ class { 'foreman::cli':
include foreman::cli::katello
include foreman::cli::virt_who_configure
include foreman::cli::rh_cloud

Yumrepo['katello'] -> Class['foreman::cli::katello']
PUPPET
end
end
Expand Down
16 changes: 16 additions & 0 deletions spec/acceptance/foreman_rh_cloud_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require 'spec_helper_acceptance'

describe 'Scenario: install foreman with rh_cloud', if: os[:family] == 'redhat' do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still wonder if this should be redhat or a list? Look at the other code that is ['debian', 'ubuntu'].include?(os[:family]).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It gets executed on both CentOS Stream and Alma (I verified that), so 🤷‍♀️

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the reason we drink ;)

before(:context) { purge_foreman }

it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
include foreman
include foreman::plugin::rh_cloud
PUPPET
end
end

it_behaves_like 'the foreman application'
end
11 changes: 11 additions & 0 deletions spec/setup_acceptance_node.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
repo => 'nightly',
}

if $facts['os']['family'] == 'RedHat' {
yumrepo { 'katello':
baseurl => "http://yum.theforeman.org/katello/nightly/katello/el${facts['os']['release']['major']}/x86_64/",
gpgcheck => 0,
}
yumrepo { 'candlepin':
baseurl => "https://yum.theforeman.org/candlepin/4.4/el${facts['os']['release']['major']}/x86_64/",
gpgcheck => 0,
}
}

# Not /etc/foreman because purging removes that
$directory = '/etc/foreman-certs'
$certificate = "${directory}/certificate.pem"
Expand Down
1 change: 1 addition & 0 deletions spec/support/acceptance/purge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ def purge_foreman

apache_service_name = ['debian', 'ubuntu'].include?(os[:family]) ? 'apache2' : 'httpd'
on default, "systemctl stop #{apache_service_name}", { :acceptable_exit_codes => [0, 5] }
on default, 'runuser - postgres -c "dropdb foreman"', { :acceptable_exit_codes => [0, 1, 127] }
end