fix runit_service tests, replace socat with a proper mock daemon

This commit is contained in:
Stephan Renatus 2016-01-21 09:53:59 +01:00
parent 492c7f8146
commit f2f2db120d
3 changed files with 18 additions and 5 deletions

View file

@ -2,7 +2,6 @@
# author: Stephan Renatus
include_recipe 'runit::default'
package 'socat'
# put ctl in alt location
directory '/opt/chef/embedded/sbin' do
@ -19,9 +18,17 @@ runit_service 'running-runit-service' do
run_template_name 'default-svlog'
end
runit_service 'non-running-runit-service' do
runit_service 'not-enabled-runit-service' do
default_logger true
run_template_name 'default-svlog'
start_down true
action :enable
end
runit_service 'not-running-runit-service' do
default_logger true
run_template_name 'default-svlog'
action :create
end
execute 'sv down not-running-runit-service'

View file

@ -1,3 +1,3 @@
#!/bin/sh
exec 2>&1
exec socat - TCP4-LISTEN:6701,fork
exec > /dev/null
exec yes

View file

@ -51,12 +51,18 @@ if os[:family] == 'centos'
it { should be_running }
end
describe runit_service('non-running-runit-service') do
describe runit_service('not-running-runit-service') do
it { should be_enabled }
it { should be_installed }
it { should_not be_running }
end
describe runit_service('not-enabled-runit-service') do
it { should_not be_enabled }
it { should be_installed }
it { should_not be_running }
end
# alt. ctl location
describe runit_service('running-runit-service', '/opt/chef/embedded/sbin/sv') do
it { should be_enabled }