@@ -187,6 +187,33 @@ var _ = Describe("LocalBackendCleaner", func() {
187187 })
188188 })
189189
190+ Describe ("doSafeCleanupWerfContainers" , func () {
191+ It ("should not return err if backend.Rm() returns 'container is paused' error" , func () {
192+ container := image.Container {
193+ ID : "id-stage" ,
194+ Names : []string {fmt .Sprintf ("/%s" , image .StageContainerNamePrefix )},
195+ }
196+
197+ backend .EXPECT ().Rm (ctx , container .ID , container_backend.RmOpts {Force : false }).Return (container_backend .ErrCannotRemovePausedContainer )
198+ stubs .StubFunc (& cleaner .volumeutilsGetVolumeUsageByPath , volumeutils.VolumeUsage {}, nil )
199+
200+ _ , err := cleaner .doSafeCleanupWerfContainers (ctx , RunGCOptions {}, volumeutils.VolumeUsage {}, image.ContainerList {container })
201+ Expect (err ).To (Succeed ())
202+ })
203+ It ("should not return err if backend.Rm() returns 'container is running' error" , func () {
204+ container := image.Container {
205+ ID : "id-import-server" ,
206+ Names : []string {fmt .Sprintf ("/%s" , image .ImportServerContainerNamePrefix )},
207+ }
208+
209+ backend .EXPECT ().Rm (ctx , container .ID , container_backend.RmOpts {Force : false }).Return (container_backend .ErrCannotRemoveRunningContainer )
210+ stubs .StubFunc (& cleaner .volumeutilsGetVolumeUsageByPath , volumeutils.VolumeUsage {}, nil )
211+
212+ _ , err := cleaner .doSafeCleanupWerfContainers (ctx , RunGCOptions {}, volumeutils.VolumeUsage {}, image.ContainerList {container })
213+ Expect (err ).To (Succeed ())
214+ })
215+ })
216+
190217 Describe ("werfImages" , func () {
191218 It ("should return images as merged and sorted result of several backend calls" , func () {
192219 expectedImages := []image.Summary {
0 commit comments