From 90fd566be8d5cd0d30b13160f2939441b16f8df6 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Wed, 6 Sep 2017 18:33:45 +0200 Subject: [PATCH] Add acceptance tests --- .sync.yml | 3 +++ .travis.yml | 6 +++++ spec/acceptance/certs_spec.rb | 44 +++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 spec/acceptance/certs_spec.rb diff --git a/.sync.yml b/.sync.yml index 0b5529c5..9e86549d 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,4 +1,7 @@ --- +.travis.yml: + beaker_sets: + - docker/centos-7 Rakefile: param_docs_pattern: - manifests/foreman_proxy_content.pp diff --git a/.travis.yml b/.travis.yml index 16514a7f..baedc018 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/spec/acceptance/certs_spec.rb b/spec/acceptance/certs_spec.rb new file mode 100644 index 00000000..992d6ef5 --- /dev/null +++ b/spec/acceptance/certs_spec.rb @@ -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