File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
test/unit/plugins/providers/docker Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -225,8 +225,9 @@ def rmi(id)
225
225
execute ( 'docker' , 'rmi' , id )
226
226
return true
227
227
rescue => e
228
- return false if e . to_s . include? ( "is using it" )
229
- return false if e . to_s . include? ( "is being used" )
228
+ return false if e . to_s . include? ( "is using it" ) or
229
+ e . to_s . include? ( "is being used" ) or
230
+ e . to_s . include? ( "is in use" )
230
231
raise if !e . to_s . include? ( "No such image" )
231
232
end
232
233
Original file line number Diff line number Diff line change 579
579
subject . rmi ( id )
580
580
end
581
581
end
582
+
583
+ context 'image is in use by a container' do
584
+ before { allow ( subject ) . to receive ( :execute ) . and_raise ( "image is in use by a container" ) }
585
+
586
+ it 'does not remove the image' do
587
+ expect ( subject . rmi ( id ) ) . to eq ( false )
588
+ subject . rmi ( id )
589
+ end
590
+ end
582
591
end
583
592
584
593
describe '#inspect_container' do
You can’t perform that action at this time.
0 commit comments