@@ -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 } \" }"
0 commit comments