diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 1fd7136..d827344 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -1,29 +1,33 @@ require 'spec_helper_acceptance' describe 'hitch class' do context 'default parameters' do # Using puppet_apply as a helper it 'should work idempotently with no errors' do pp = <<-EOS class { 'hitch': } hitch::domain { 'example.org': key_source => '/tmp/example.org_key.pem', cert_source => '/tmp/example.org_cert.pem', } + hitch::domain { 'example.com': + key_source => '/tmp/example.com_key.pem', + cert_source => '/tmp/example.com_cert.pem', + } EOS # Run it twice and test for idempotency apply_manifest(pp, :catch_failures => true) apply_manifest(pp, :catch_changes => true) end describe package('hitch') do it { is_expected.to be_installed } end describe service('hitch') do it { is_expected.to be_enabled } it { is_expected.to be_running } end end end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index a743bfa..c5abb30 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,25 +1,27 @@ require 'beaker-rspec/spec_helper' require 'beaker-rspec/helpers/serverspec' require 'beaker/puppet_install_helper' run_puppet_install_helper unless ENV['BEAKER_provision'] == 'no' RSpec.configure do |c| # Project root proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) # Readable test descriptions c.formatter = :documentation # Configure all nodes in nodeset c.before :suite do # Install module and dependencies puppet_module_install(:source => proj_root, :module_name => 'hitch') hosts.each do |host| on host, puppet('module', 'install', 'puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] } on host, puppet('module', 'install', 'puppetlabs-concat'), { :acceptable_exit_codes => [0,1] } - on host, 'openssl req -newkey rsa:2048 -sha256 -keyout /tmp/example.org_key.pem -nodes -x509 -days 365 -out /tmp/example.org_cert.pem -subj "/CN=example.org"' + ['example.com', 'example.org'].each do |domain| + on host, 'openssl req -newkey rsa:2048 -sha256 -keyout /tmp/%s_key.pem -nodes -x509 -days 365 -out /tmp/%s_cert.pem -subj "/CN=%s"' % [ domain, domain, domain ] + end on host, 'ls -l /tmp' end end end