9
9
raise 'Could not retrieve ip address for Windows box' if result . exit_code != 0
10
10
ip = result . stdout . split ( "\n " ) [ 0 ] . split ( ':' ) [ 1 ] . strip
11
11
@windows_ip = ip
12
- docker_arg = "docker_ee => true, extra_parameters => '\" insecure-registries\" : [ \" #{ @windows_ip } :5000\" ]'"
12
+ docker_args = "docker_ee => true, extra_parameters => '\" insecure-registries\" : [ \" #{ @windows_ip } :5000\" ]'"
13
+ root_dir = 'C:/Users/Administrator/AppData/Local/Temp'
13
14
docker_registry_image = 'stefanscherer/registry-windows'
14
15
docker_network = 'nat'
15
16
registry_host = @windows_ip
16
17
config_file = '/cygdrive/c/Users/Administrator/.docker/config.json'
17
- root_dir = 'C:/Users/Administrator/AppData/Local/Temp'
18
18
server_strip = "#{ registry_host } _#{ registry_port } "
19
19
bad_server_strip = "#{ registry_host } _5001"
20
20
broken = true
43
43
context 'When adding system user' , win_broken : broken do
44
44
let ( :pp ) do
45
45
"
46
- class { 'docker': #{ docker_arg }
46
+ class { 'docker': #{ docker_args } ,
47
47
docker_users => ['user1']
48
48
}
49
- "
49
+ "
50
50
end
51
51
52
52
it 'the docker daemon' do
@@ -56,6 +56,31 @@ class { 'docker': #{docker_arg}
56
56
end
57
57
end
58
58
59
+ context 'When root_dir is set' do
60
+ let ( :pp ) do
61
+ "class { 'docker': #{ docker_args } , root_dir => \" #{ root_dir } \" }"
62
+ end
63
+
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
71
+
72
+ it 'works' do
73
+ apply_manifest ( pp , catch_failures : true )
74
+ run_shell ( shell_command ) do |r |
75
+ if os [ :family ] == 'windows'
76
+ expect ( r . stdout ) . to match ( %r{\" data-root\" : \" #{ root_dir } \" } )
77
+ else
78
+ expect ( r . stdout ) . to match ( %r{--data-root #{ root_dir } } )
79
+ end
80
+ end
81
+ end
82
+ end
83
+
59
84
context 'with default parameters' , win_broken : broken do
60
85
let ( :pp ) do
61
86
"
@@ -177,7 +202,7 @@ class { 'docker':
177
202
178
203
it 'is able to run registry' do
179
204
pp = <<-MANIFEST
180
- class { 'docker': #{ docker_arg } }
205
+ class { 'docker': #{ docker_args } }
181
206
docker::run { 'registry':
182
207
image => '#{ docker_registry_image } ',
183
208
pull_on_start => true,
0 commit comments