diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2974af38..1f82c4c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,4 +18,4 @@ concurrency: jobs: puppet: name: Puppet - uses: voxpupuli/gha-puppet/.github/workflows/basic.yml@v2 + uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v2 diff --git a/.sync.yml b/.sync.yml index 9c99fc2a..e82b0529 100644 --- a/.sync.yml +++ b/.sync.yml @@ -3,3 +3,5 @@ Gemfile: optional: ':test': - gem: webmock +spec/spec_helper_acceptance.rb: + unmanaged: false diff --git a/examples/x509_cert.pp b/examples/x509_cert.pp index 8d0faacd..a60ec441 100644 --- a/examples/x509_cert.pp +++ b/examples/x509_cert.pp @@ -1,9 +1,9 @@ -openssl::certificate::x509 { 'foo.bar': +openssl::certificate::x509 { 'foo.example.com': ensure => present, country => 'CH', organization => 'Example.com', - commonname => $fqdn, + commonname => 'foo.example.com', base_dir => '/tmp', - owner => 'www-data', + owner => 'nobody', password => 'mahje1Qu', } diff --git a/spec/acceptance/dhparam_spec.rb b/spec/acceptance/dhparam_spec.rb new file mode 100644 index 00000000..d6a9f8af --- /dev/null +++ b/spec/acceptance/dhparam_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper_acceptance' + +describe 'x509_cert example' do + it_behaves_like 'the example', 'dhparam.pp' do + it { expect(file('/etc/ssl/certs/dhparam.pem')).to be_file } + end +end diff --git a/spec/acceptance/x509_cert_spec.rb b/spec/acceptance/x509_cert_spec.rb new file mode 100644 index 00000000..a84651b5 --- /dev/null +++ b/spec/acceptance/x509_cert_spec.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +require 'spec_helper_acceptance' + +describe 'x509_cert example' do + it_behaves_like 'the example', 'x509_cert.pp' do + it { expect(file('/tmp/foo.example.com.crt')).to be_file.and(have_attributes(owner: 'nobody')) } + it { expect(x509_certificate('/tmp/foo.example.com.crt')).to be_certificate.and(have_attributes(subject: 'C = CH, O = Example.com, CN = foo.example.com')) } + + it { expect(file('/tmp/foo.example.com.key')).to be_file.and(have_attributes(owner: 'nobody', mode: '600')) } + it { expect(x509_private_key('/tmp/foo.example.com.key', passin: 'pass:mahje1Qu')).to have_matching_certificate('/tmp/foo.example.com.crt') } + end +end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 72eb7686..2681792e 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,21 +1,10 @@ # frozen_string_literal: true -require 'beaker-pe' -require 'beaker-puppet' -require 'puppet' -require 'beaker-rspec/spec_helper' -require 'beaker-rspec/helpers/serverspec' -require 'beaker/puppet_install_helper' -require 'beaker/module_install_helper' -require 'beaker-task_helper' +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -run_puppet_install_helper -configure_type_defaults_on(hosts) -install_ca_certs unless pe_install? -# install_bolt_on(hosts) unless pe_install? -install_module_on(hosts) -install_module_dependencies_on(hosts) +require 'voxpupuli/acceptance/spec_helper_acceptance' -RSpec.configure do |c| - c.formatter = :documentation -end +configure_beaker(modules: :metadata) + +Dir['./spec/support/acceptance/**/*.rb'].sort.each { |f| require f }