Skip to content

Commit f9f80c5

Browse files
committed
Adding new acceptance test
1 parent 4587441 commit f9f80c5

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

spec/acceptance/docker_spec.rb

+43
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,49 @@ class { 'docker': #{docker_args},
5656
end
5757
end
5858

59+
context 'When prepare_service_only param is set(prepare_service_only => true)', win_broken: broken do
60+
let(:pp) do
61+
"
62+
class { 'docker': #{docker_args} }
63+
docker::run { 'servercore':
64+
image => 'hello-world:latest',
65+
prepare_service_only => true,
66+
}
67+
"
68+
end
69+
70+
it 'creates the service without starting it' do
71+
apply_manifest(pp, catch_failures: true)
72+
end
73+
74+
it 'not start the service' do
75+
run_shell('systemctl status docker-servercore', expect_failures: true) do |r|
76+
expect(r.stdout.include?('Main PID')).to be false
77+
end
78+
end
79+
end
80+
81+
context 'When prepare_service_only param is not set(prepare_service_only => false)', win_broken: broken do
82+
let(:pp) do
83+
"
84+
class { 'docker': #{docker_args} }
85+
docker::run { 'servercore':
86+
image => 'hello-world:latest',
87+
}
88+
"
89+
end
90+
91+
it 'creates the service and start it' do
92+
apply_manifest(pp, catch_failures: true)
93+
end
94+
95+
it 'start the service' do
96+
run_shell('systemctl status docker-servercore', expect_failures: true) do |r|
97+
expect(r.stdout.include?('Main PID')).to be true
98+
end
99+
end
100+
end
101+
59102
context 'When root_dir is set' do
60103
let(:pp) do
61104
"class { 'docker': #{docker_args}, root_dir => \"#{root_dir}\"}"

templates/docker-run-start.erb

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
/usr/bin/<%= @docker_command %> create \
1313
<%= @docker_run_flags %> \
1414
--name <%= @sanitised_title %> \
15-
<%= @image %> \
16-
<% if @command %> <%= @command %><% end %>
15+
<%= @image %> <% if @command %> \ <%= @command %><% end %>
1716

1817
<% if @after_create %><%= @after_create %><% end %>
1918
<% if @net.is_a? Array%>

0 commit comments

Comments
 (0)