Skip to content

Commit 2c48f10

Browse files
authored
Update docker_spec.rb
1 parent e31e52b commit 2c48f10

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

Diff for: spec/acceptance/docker_spec.rb

+14-15
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
class { 'docker': #{docker_args},
4747
docker_users => ['user1']
4848
}
49-
"
49+
"
5050
end
5151

5252
it 'the docker daemon' do
@@ -56,26 +56,25 @@ class { 'docker': #{docker_args},
5656
end
5757
end
5858

59-
context 'Checking root_dir value' do
60-
docker_args = docker_args + 'root_dir =>' + '"' + root_dir + '"'
59+
context 'When root_dir is set' do
6160
let(:pp) do
62-
"class { 'docker': #{docker_args}}"
61+
"class { 'docker': #{docker_args}, root_dir => \"#{root_dir}\"}"
6362
end
6463

65-
it 'is good' do
66-
file_path = if os[:family] == 'windows'
67-
'C:/ProgramData/docker/config/daemon.json'
68-
else
69-
'/etc/docker/daemon.json'
70-
end
64+
let(:shell_command) do
65+
if os[:family] == 'windows'
66+
'cat C:/ProgramData/docker/config/daemon.json'
67+
else
68+
'systemctl status docker'
69+
end
70+
end
7171

72+
it 'works' do
7273
apply_manifest(pp, catch_failures: true)
73-
if os[:family] == 'windows'
74-
run_shell("cat #{file_path}") do |r|
74+
run_shell(shell_command) do |r|
75+
if os[:family] == 'windows'
7576
expect(r.stdout).to match(%r{\"data-root\": \"#{root_dir}\"})
76-
end
77-
else
78-
run_shell('systemctl status docker') do |r|
77+
else
7978
expect(r.stdout).to match(%r{--data-root #{root_dir}})
8079
end
8180
end

0 commit comments

Comments
 (0)