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 a basic acceptance test #635

Merged
merged 1 commit into from
Apr 10, 2018
Merged
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
68 changes: 68 additions & 0 deletions spec/acceptance/foreman_basic_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
require 'spec_helper_acceptance'

describe 'Scenario: install foreman' do
before(:context) do
case os[:family]
when /redhat|fedora/
on default, 'yum -y remove foreman* tfm-* && rm -rf /etc/yum.repos.d/foreman*.repo'
when /debian|ubuntu/
on default, 'apt-get purge -y foreman*', { :acceptable_exit_codes => [0, 100] }
on default, 'apt-get purge -y ruby-hammer-cli-*', { :acceptable_exit_codes => [0, 100] }
on default, 'rm -rf /etc/apt/sources.list.d/foreman*'
end
end

let(:pp) do
configure = os[:family] == 'redhat' && os[:family] != 'fedora'
<<-EOS
# Workarounds

## Ensure repos are present before installing
Yumrepo <| |> -> Package <| |>

## We want passenger from EPEL
class { '::apache::mod::passenger':
manage_repo => false,
}

# Get a certificate from puppet
exec { 'puppet_server_config-generate_ca_cert':
creates => '/etc/puppetlabs/puppet/ssl/certs/#{host_inventory['fqdn']}.pem',
command => '/opt/puppetlabs/bin/puppet ca generate #{host_inventory['fqdn']}',
umask => '0022',
}

# Actual test
class { '::foreman':
custom_repo => false,
repo => 'nightly',
gpgcheck => true,
configure_epel_repo => #{configure},
configure_scl_repo => #{configure},
user_groups => [],
admin_username => 'admin',
admin_password => 'changeme',
}
EOS
end

it_behaves_like 'a idempotent resource'

describe service(os[:family] == 'debian' ? 'apache2' : 'httpd') do
it { is_expected.to be_enabled }
it { is_expected.to be_running }
end

describe service('dynflowd') do
it { is_expected.to be_enabled }
it { is_expected.to be_running }
end

describe port(80) do
it { is_expected.to be_listening }
end

describe port(443) do
it { is_expected.to be_listening }
end
end