File tree Expand file tree Collapse file tree 2 files changed +17
-9
lines changed Expand file tree Collapse file tree 2 files changed +17
-9
lines changed Original file line number Diff line number Diff line change 56
56
# Delete all running containers
57
57
shell ( "#{ docker_command } rm -f $(#{ docker_command } ps -a -q) || true" )
58
58
# Delete all existing images
59
- shell ( "#{ docker_command } rmi $(#{ docker_command } images -q) || true" )
59
+ shell ( "#{ docker_command } rmi -f $(#{ docker_command } images -q) || true" )
60
60
# Check to make sure no images are present
61
61
shell ( "#{ docker_command } images | wc -l" ) do |r |
62
62
expect ( r . stdout ) . to match ( /^0|1$/ )
@@ -228,20 +228,28 @@ class { 'docker':
228
228
end
229
229
end
230
230
231
-
232
231
context 'uninstall docker' do
233
- before ( :each ) do
232
+ after ( :all ) do
234
233
@pp = <<-EOS
235
- class {'docker':
236
- ensure => 'absent '
234
+ class {'docker': #{ docker_args } ,
235
+ ensure => 'present '
237
236
}
238
237
EOS
239
238
apply_manifest ( @pp , :catch_failures => true )
240
- sleep 4
239
+
240
+ # Wait for reboot if windows
241
+ sleep 300 if fact ( 'osfamily' ) == 'windows'
241
242
end
242
243
243
244
it 'should uninstall successfully' do
244
- shell ( 'docker ps' , :acceptable_exit_codes => [ 1 , 127 ] )
245
+ @pp = <<-EOS
246
+ class {'docker': #{ docker_args } ,
247
+ ensure => 'absent'
248
+ }
249
+ EOS
250
+ apply_manifest ( @pp , :catch_failures => true )
251
+ sleep 4
252
+ shell ( 'docker ps' , :acceptable_exit_codes => [ 1 , 127 ] )
245
253
end
246
254
end
247
255
end
Original file line number Diff line number Diff line change @@ -8,10 +8,10 @@ $service = Get-Service "docker" -ErrorAction Ignore
8
8
if ( -not $service ) {
9
9
$cleanInstall = $true
10
10
} elseif ( $service.Status -ne [ServiceProcess.ServiceControllerStatus]::Stopped ) {
11
- $timeSpan = New-Object Timespan 0,0, 60
11
+ $timeSpan = New-Timespan -Seconds 60
12
12
try {
13
13
$service.Stop()
14
- $service.WaitForStatus([ServiceProcess.ServiceControllerStatus]::Stopped, 60 )
14
+ $service.WaitForStatus([ServiceProcess.ServiceControllerStatus]::Stopped, $timeSpan )
15
15
}
16
16
catch [Management.Automation.MethodInvocationException],[ServiceProcess.TimeoutException] {
17
17
Write-Error "Failed to stop docker service"
You can’t perform that action at this time.
0 commit comments