File tree 1 file changed +14
-15
lines changed
1 file changed +14
-15
lines changed Original file line number Diff line number Diff line change 46
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,26 +56,25 @@ class { 'docker': #{docker_args},
56
56
end
57
57
end
58
58
59
- context 'Checking root_dir value' do
60
- docker_args = docker_args + 'root_dir =>' + '"' + root_dir + '"'
59
+ context 'When root_dir is set' do
61
60
let ( :pp ) do
62
- "class { 'docker': #{ docker_args } }"
61
+ "class { 'docker': #{ docker_args } , root_dir => \" #{ root_dir } \" }"
63
62
end
64
63
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
71
71
72
+ it 'works' do
72
73
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'
75
76
expect ( r . stdout ) . to match ( %r{\" data-root\" : \" #{ root_dir } \" } )
76
- end
77
- else
78
- run_shell ( 'systemctl status docker' ) do |r |
77
+ else
79
78
expect ( r . stdout ) . to match ( %r{--data-root #{ root_dir } } )
80
79
end
81
80
end
You can’t perform that action at this time.
0 commit comments