Skip to content

Commit

Permalink
Add a basic acceptance test
Browse files Browse the repository at this point in the history
  • Loading branch information
ekohl committed Apr 10, 2018
1 parent 68f58af commit fb6deef
Showing 1 changed file with 68 additions and 0 deletions.
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

0 comments on commit fb6deef

Please sign in to comment.