Skip to content

Commit

Permalink
Add acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ekohl committed Sep 6, 2017
1 parent 5759e85 commit 90fd566
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
.travis.yml:
beaker_sets:
- docker/centos-7
Rakefile:
param_docs_pattern:
- manifests/foreman_proxy_content.pp
Expand Down
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,11 @@ matrix:
env: PUPPET_VERSION=4.6 ONLY_OS=redhat-7-x86_64,centos-7-x86_64
- rvm: 2.4.1
env: PUPPET_VERSION=5.0 ONLY_OS=redhat-7-x86_64,centos-7-x86_64
- rvm: 2.3.1
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/centos-7
script: bundle exec rake beaker
services: docker
bundler_args: --without development
bundler_args: --without system_tests development
sudo: false
44 changes: 44 additions & 0 deletions spec/acceptance/certs_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
require 'spec_helper_acceptance'

describe 'certs with default params' do
before(:all) do
install_repo = <<-EOS
yumrepo { 'katello':
descr => 'Katello latest',
baseurl => 'https://fedorapeople.org/groups/katello/releases/yum/latest/katello/el7/$basearch/',
gpgcheck => false,
enabled => true,
}
EOS

apply_manifest(install_repo)
end

context 'with default params' do
let(:pp) do
'include ::certs'
end

it_behaves_like 'a idempotent resource'

describe package('katello-certs-tools') do
it { is_expected.to be_installed }
end

describe x509_certificate('/etc/pki/katello-certs-tools/certs/katello-default-ca.crt') do
it { should be_certificate }
it { should be_valid }
it { should have_purpose 'SSL server CA' }
its(:issuer) { should eq "/C=US/ST=North Carolina/L=Raleigh/O=Katello/OU=SomeOrgUnit/CN=#{fact('fqdn')}" }
its(:subject) { should eq "/C=US/ST=North Carolina/L=Raleigh/O=Katello/OU=SomeOrgUnit/CN=#{fact('fqdn')}" }
end

describe x509_certificate('/etc/pki/katello-certs-tools/certs/katello-server-ca.crt') do
it { should be_certificate }
it { should be_valid }
it { should have_purpose 'SSL server CA' }
its(:issuer) { should eq "/C=US/ST=North Carolina/L=Raleigh/O=Katello/OU=SomeOrgUnit/CN=#{fact('fqdn')}" }
its(:subject) { should eq "/C=US/ST=North Carolina/L=Raleigh/O=Katello/OU=SomeOrgUnit/CN=#{fact('fqdn')}" }
end
end
end

0 comments on commit 90fd566

Please sign in to comment.