Skip to content

Commit a4545ed

Browse files
committed
Solve nginx error
1 parent 78ad963 commit a4545ed

File tree

1 file changed

+28
-15
lines changed

1 file changed

+28
-15
lines changed

spec/acceptance/docker_spec.rb

+28-15
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
raise 'Could not retrieve ip address for Windows box' if result.exit_code != 0
1010
ip = result.stdout.split("\n")[0].split(':')[1].strip
1111
@windows_ip = ip
12-
docker_args = "docker_ee => true, extra_parameters => '\"insecure-registries\": [ \"#{@windows_ip}:5000\" ]', root_dir => 'C:/Users/Administrator/AppData/Local/Temp'
13-
"
12+
docker_args = "docker_ee => true, extra_parameters => '\"insecure-registries\": [ \"#{@windows_ip}:5000\" ]'"
13+
root_dir = 'C:/Users/Administrator/AppData/Local/Temp'
1414
docker_registry_image = 'stefanscherer/registry-windows'
1515
docker_network = 'nat'
1616
registry_host = @windows_ip
@@ -43,28 +43,41 @@
4343
context 'When adding system user', win_broken: broken do
4444
let(:pp) do
4545
"
46-
class { 'docker': #{docker_args}
46+
class { 'docker': #{docker_args},
4747
docker_users => ['user1']
4848
}
4949
"
5050
end
5151

52-
context 'Checking root_dir value' do
53-
let(:pp) do
54-
"class { 'docker': #{docker_args}}"
52+
it 'the docker daemon' do
53+
apply_manifest(pp, catch_failures: true) do |r|
54+
expect(r.stdout).not_to match(%r{docker-systemd-reload-before-service})
5555
end
56+
end
57+
end
5658

57-
it 'is good' do
58-
apply_manifest(pp, catch_failures: true)
59-
run_shell('cat C:/ProgramData/docker/config/daemon.json') do |r|
60-
expect(r.stdout).to match(%r{data-root})
61-
end
62-
end
59+
context 'Checking root_dir value' do
60+
docker_args = docker_args + ',root_dir =>' + '"' + root_dir + '"'
61+
let(:pp) do
62+
"class { 'docker': #{docker_args}}"
6363
end
6464

65-
it 'the docker daemon' do
66-
apply_manifest(pp, catch_failures: true) do |r|
67-
expect(r.stdout).not_to match(%r{docker-systemd-reload-before-service})
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
71+
72+
apply_manifest(pp, catch_failures: true)
73+
if os[:family] == 'windows'
74+
run_shell("cat #{file_path}") do |r|
75+
expect(r.stdout).to match(%r{\"data-root\": \"#{root_dir}\"})
76+
end
77+
else
78+
run_shell('systemctl status docker') do |r|
79+
expect(r.stdout).to match(%r{--data-root #{root_dir}})
80+
end
6881
end
6982
end
7083
end

0 commit comments

Comments
 (0)