From bc771d07c8010d5b7c8ed5ad954bc3467f5a7f78 Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Tue, 24 Jul 2018 13:09:58 +0200 Subject: [PATCH] Add idempotency test Add a test to ensure the module is idempotent. By doing this extra work, the ethercalc service has enough time to figure things out and get started, so we can also enable the checks to ensure the service is responding. Change-Id: Iede6db9dda0814bee9072c6dcc554ccc1aa89af1 --- spec/acceptance/ethercalc_spec.rb | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/spec/acceptance/ethercalc_spec.rb b/spec/acceptance/ethercalc_spec.rb index face6f4..aede7d0 100644 --- a/spec/acceptance/ethercalc_spec.rb +++ b/spec/acceptance/ethercalc_spec.rb @@ -15,6 +15,10 @@ describe 'puppet-ethercalc:: manifest', :if => ['debian', 'ubuntu'].include?(os[ apply_manifest(init_puppet_module, catch_failures: true) end + it 'should be idempotent' do + apply_manifest(init_puppet_module, catch_changes: true) + end + describe 'required packages' do describe 'os packages' do required_packages = [ @@ -36,19 +40,16 @@ describe 'puppet-ethercalc:: manifest', :if => ['debian', 'ubuntu'].include?(os[ end end - # TODO(ianw): not quite reliable ... possibly need this in a retry - # loop for a little to let the service start up? + describe 'required services' do + describe 'ports are open and services are reachable' do + describe port(8000) do + it { should be_listening } + end - # describe 'required services' do - # describe 'ports are open and services are reachable' do - # describe port(8000) do - # it { should be_listening } - # end - - # describe command('curl http://localhost:8000 --verbose') do - # its(:stdout) { should contain('EtherCalc - Share the URL to your friends') } - # end - # end - # end + describe command('curl http://localhost:8000 --verbose') do + its(:stdout) { should contain('EtherCalc - Share the URL to your friends') } + end + end + end end