2013-11-22 04:10:53 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
describe 'nginx::service' do
|
|
|
|
|
2014-03-04 17:46:45 +01:00
|
|
|
let :params do {
|
|
|
|
:configtest_enable => false,
|
2015-12-04 04:47:48 +01:00
|
|
|
:service_restart => '/etc/init.d/nginx reload',
|
2014-03-04 17:46:45 +01:00
|
|
|
:service_ensure => 'running',
|
2014-09-22 03:13:53 +02:00
|
|
|
:service_name => 'nginx',
|
2014-09-21 01:25:24 +02:00
|
|
|
} end
|
2013-11-22 04:10:53 +01:00
|
|
|
|
|
|
|
context "using default parameters" do
|
|
|
|
|
2014-07-18 04:28:38 +02:00
|
|
|
it { is_expected.to contain_service('nginx').with(
|
2013-11-22 04:10:53 +01:00
|
|
|
:ensure => 'running',
|
|
|
|
:enable => true,
|
|
|
|
:hasstatus => true,
|
2013-12-01 01:56:38 +01:00
|
|
|
:hasrestart => true
|
2013-11-22 04:10:53 +01:00
|
|
|
)}
|
|
|
|
|
2014-07-18 04:28:38 +02:00
|
|
|
it { is_expected.to contain_service('nginx').without_restart }
|
2013-11-22 04:10:53 +01:00
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "when configtest_enable => true" do
|
2014-09-05 05:24:14 +02:00
|
|
|
let :params do {
|
|
|
|
:configtest_enable => true,
|
2015-12-04 04:47:48 +01:00
|
|
|
:service_restart => '/etc/init.d/nginx reload',
|
2014-09-05 05:24:14 +02:00
|
|
|
:service_ensure => 'running',
|
2014-09-22 03:13:53 +02:00
|
|
|
:service_name => 'nginx',
|
2014-09-05 05:24:14 +02:00
|
|
|
} end
|
2015-12-03 14:07:58 +01:00
|
|
|
it { is_expected.to contain_service('nginx').with_restart('/etc/init.d/nginx reload') }
|
2013-11-22 04:10:53 +01:00
|
|
|
|
|
|
|
context "when service_restart => 'a restart command'" do
|
2014-09-05 05:24:14 +02:00
|
|
|
let :params do {
|
|
|
|
:configtest_enable => true,
|
|
|
|
:service_restart => 'a restart command',
|
|
|
|
:service_ensure => 'running',
|
2014-09-22 03:13:53 +02:00
|
|
|
:service_name => 'nginx',
|
2014-09-05 05:24:14 +02:00
|
|
|
} end
|
2014-07-18 04:28:38 +02:00
|
|
|
it { is_expected.to contain_service('nginx').with_restart('a restart command') }
|
2013-11-22 04:10:53 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-22 03:13:53 +02:00
|
|
|
describe "when service_name => 'nginx14" do
|
|
|
|
let :params do {
|
|
|
|
:service_name => 'nginx14',
|
|
|
|
} end
|
|
|
|
it { is_expected.to contain_service('nginx').with_name('nginx14') }
|
|
|
|
end
|
2013-11-22 04:10:53 +01:00
|
|
|
end
|