Skip to content

Commit

Permalink
Add an acceptance test for candlepin
Browse files Browse the repository at this point in the history
  • Loading branch information
ekohl committed Sep 7, 2017
1 parent d6dfd44 commit 729f5d7
Showing 1 changed file with 95 additions and 0 deletions.
95 changes: 95 additions & 0 deletions spec/acceptance/candlepin_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
require 'json'
require 'spec_helper_acceptance'

describe 'Installing candlepin with the right certificates' do

status_url = "https://#{fact('fqdn')}:8443/candlepin/status --cacert /etc/pki/katello/certs/katello-default-ca.crt"

[false, true].each do |qpid|
context "qpid => #{qpid}" do
let :pp do
<<-EOS
$repo = 'latest'
$dist = 'el7'
$group = 'foreman'
$amq_enable = #{qpid}
yumrepo { 'candlepin':
descr => 'Candlepin: an open source entitlement management system.',
baseurl => "https://fedorapeople.org/groups/katello/releases/yum/${repo}/candlepin/${dist}/\\$basearch/",
gpgkey => 'https://raw.githubusercontent.com/Katello/katello-packaging/master/repos/RPM-GPG-KEY-katello-2015',
gpgcheck => '0',
enabled => '1',
}
yumrepo { 'katello':
descr => 'Katello latest',
baseurl => "https://fedorapeople.org/groups/katello/releases/yum/${repo}/katello/${dist}/\\$basearch/",
gpgkey => 'https://raw.githubusercontent.com/Katello/katello-packaging/master/repos/RPM-GPG-KEY-katello-2015',
gpgcheck => '0',
enabled => '1',
}
group { $group:
ensure => 'present',
system => true,
}
class { '::certs':
group => $group,
}
if $amq_enable {
class { '::certs::qpid':
require => Class['certs'],
} ->
class { '::qpid':
ssl => true,
ssl_cert_db => $::certs::nss_db_dir,
ssl_cert_password_file => $::certs::qpid::nss_db_password_file,
ssl_cert_name => 'broker',
interface => 'lo',
}
}
class { '::certs::candlepin':
require => Class['certs'],
amqp_enable => $amq_enable,
} ->
class { '::candlepin':
user_groups => $group,
ca_key => $::certs::ca_key,
ca_cert => $::certs::ca_cert_stripped,
keystore_password => $::certs::candlepin::keystore_password,
truststore_password => $::certs::candlepin::keystore_password,
enable_basic_auth => false,
consumer_system_name_pattern => '.+',
adapter_module => 'org.candlepin.katello.KatelloModule',
amq_enable => $amq_enable,
amqp_keystore_password => $::certs::candlepin::keystore_password,
amqp_truststore_password => $::certs::candlepin::keystore_password,
amqp_keystore => $::certs::candlepin::amqp_keystore,
amqp_truststore => $::certs::candlepin::amqp_truststore,
}
EOS
end

it_behaves_like 'a idempotent resource'

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

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

describe "API" do
it 'should return the correct status' do
data = JSON.load curl_on(default, status_url).stdout
expect(data['result']).to be true
end
end
end
end
end

0 comments on commit 729f5d7

Please sign in to comment.