From eecb295377844a726a399832c12ce283c000bf9a Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Fri, 5 Feb 2016 09:05:15 +0100 Subject: [PATCH] add tests for upstart on centos ...which are failing --- .../recipes/_upstart_service_centos.rb | 21 ++++++++++++++++ .../cookbooks/os_prepare/recipes/service.rb | 1 + .../test/integration/default/service_spec.rb | 24 +++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 test/integration/cookbooks/os_prepare/recipes/_upstart_service_centos.rb diff --git a/test/integration/cookbooks/os_prepare/recipes/_upstart_service_centos.rb b/test/integration/cookbooks/os_prepare/recipes/_upstart_service_centos.rb new file mode 100644 index 000000000..2a27313c8 --- /dev/null +++ b/test/integration/cookbooks/os_prepare/recipes/_upstart_service_centos.rb @@ -0,0 +1,21 @@ +# encoding: utf-8 +# author: Stephan Renatus + +file "/etc/init/upstart-running.conf" do + content "exec tail -f /dev/null" +end + +file "/etc/init/upstart-enabled-not-running.conf" do + content "exec tail -f /dev/null\nstart on networking" +end + +file "/etc/init/upstart-enabled-and-running.conf" do + content "exec tail -f /dev/null\nstart on networking" +end + +%w{ enabled-and-running running }.each do |srv| + service "upstart-#{srv}" do + provider Chef::Provider::Service::Upstart + action :start + end +end diff --git a/test/integration/cookbooks/os_prepare/recipes/service.rb b/test/integration/cookbooks/os_prepare/recipes/service.rb index 795a8e969..0e36ec1e1 100644 --- a/test/integration/cookbooks/os_prepare/recipes/service.rb +++ b/test/integration/cookbooks/os_prepare/recipes/service.rb @@ -13,4 +13,5 @@ when 'ubuntu' when 'centos' # install runit for alternative service mgmt include_recipe 'os_prepare::_runit_service_centos' + include_recipe 'os_prepare::_upstart_service_centos' end diff --git a/test/integration/test/integration/default/service_spec.rb b/test/integration/test/integration/default/service_spec.rb index 80c4b285b..37ea0dd98 100644 --- a/test/integration/test/integration/default/service_spec.rb +++ b/test/integration/test/integration/default/service_spec.rb @@ -78,4 +78,28 @@ if os[:family] == 'centos' it { should_not be_installed } it { should_not be_running } end + + describe upstart_service('upstart-running') do + it { should_not be_enabled } + it { should be_installed } + it { should be_running } + end + + describe upstart_service('upstart-enabled-and-running') do + it { should be_enabled } + it { should be_installed } + it { should be_running } + end + + describe upstart_service('upstart-enabled-not-running') do + it { should be_enabled } + it { should be_installed } + it { should_not be_running } + end + + describe upstart_service('unknown') do + it { should_not be_enabled } + it { should_not be_installed } + it { should_not be_running } + end end