From 3baf809e4e061ebe6c3f2dad4422e74e7b656ffe Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Tue, 24 Jul 2018 13:13:47 +0200 Subject: [PATCH] Add test for ethercalc::apache Add the ethercalc::apache class to the test fixture and ensure the service is accessible over port 80. This also corrects a minor idempotency issue in this class due to the way the ssl-cert package and the /etc/ssl/private file resources were ordered. Change-Id: I4cdba5b1881c3e9891ca9f8c2c4dd50ca5662d4e --- manifests/apache.pp | 7 ++++--- spec/acceptance/ethercalc_spec.rb | 4 ++++ spec/acceptance/fixtures/ethercalc.pp | 6 ++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/manifests/apache.pp b/manifests/apache.pp index 758d836..5df8fe1 100644 --- a/manifests/apache.pp +++ b/manifests/apache.pp @@ -152,9 +152,10 @@ class ethercalc::apache ( } file { '/etc/ssl/private': - ensure => directory, - owner => 'root', - mode => '0700', + ensure => directory, + owner => 'root', + mode => '0700', + require => Package['ssl-cert'], } if $ssl_cert_file_contents != '' { diff --git a/spec/acceptance/ethercalc_spec.rb b/spec/acceptance/ethercalc_spec.rb index aede7d0..e45bad3 100644 --- a/spec/acceptance/ethercalc_spec.rb +++ b/spec/acceptance/ethercalc_spec.rb @@ -49,6 +49,10 @@ describe 'puppet-ethercalc:: manifest', :if => ['debian', 'ubuntu'].include?(os[ describe command('curl http://localhost:8000 --verbose') do its(:stdout) { should contain('EtherCalc - Share the URL to your friends') } end + + describe command('curl -L -k http://localhost --verbose') do + its(:stdout) { should contain('EtherCalc - Share the URL to your friends') } + end end end diff --git a/spec/acceptance/fixtures/ethercalc.pp b/spec/acceptance/fixtures/ethercalc.pp index d721bd3..c86350c 100644 --- a/spec/acceptance/fixtures/ethercalc.pp +++ b/spec/acceptance/fixtures/ethercalc.pp @@ -3,3 +3,9 @@ $source_dir = '/opt/openstack-health' include ethercalc::redis class { '::ethercalc': } + +class { '::ethercalc::apache': + ssl_cert_file => '/etc/ssl/certs/ssl-cert-snakeoil.pem', + ssl_key_file => '/etc/ssl/private/ssl-cert-snakeoil.key', + vhost_name => 'localhost', +}