@@ -293,4 +293,51 @@ var _ = Describe("Podman checkpoint", func() {
293
293
Expect (result ).Should (Exit (0 ))
294
294
Expect (podmanTest .NumberOfContainersRunning ()).To (Equal (0 ))
295
295
})
296
+
297
+ It ("podman run with checkpoint image" , func () {
298
+ // Container image must be lowercase
299
+ checkpointImage := "alpine-checkpoint-" + strings .ToLower (RandomString (6 ))
300
+ containerName := "alpine-container-" + RandomString (6 )
301
+
302
+ // Create container
303
+ localRunString := []string {"run" , "-d" , "--name" , containerName , ALPINE , "top" }
304
+ session := podmanTest .Podman (localRunString )
305
+ session .WaitWithDefaultTimeout ()
306
+ Expect (session ).Should (Exit (0 ))
307
+ containerID1 := session .OutputToString ()
308
+
309
+ // Checkpoint container, create checkpoint image
310
+ result := podmanTest .Podman ([]string {"container" , "checkpoint" , "--create-image" , checkpointImage , "--keep" , containerID1 })
311
+ result .WaitWithDefaultTimeout ()
312
+ Expect (result ).Should (Exit (0 ))
313
+ Expect (podmanTest .NumberOfContainersRunning ()).To (Equal (0 ))
314
+
315
+ // Remove existing container
316
+ result = podmanTest .Podman ([]string {"rm" , "-t" , "1" , "-f" , containerName })
317
+ result .WaitWithDefaultTimeout ()
318
+ Expect (result ).Should (Exit (0 ))
319
+
320
+ // Restore containers from image using `podman run`
321
+ result = podmanTest .Podman ([]string {"run" , checkpointImage })
322
+ result .WaitWithDefaultTimeout ()
323
+ Expect (result ).Should (Exit (0 ))
324
+ Expect (podmanTest .NumberOfContainersRunning ()).To (Equal (1 ))
325
+
326
+ // Check if the container is running
327
+ status := podmanTest .Podman ([]string {"inspect" , containerName , "--format={{.State.Status}}" })
328
+ status .WaitWithDefaultTimeout ()
329
+ Expect (status ).Should (Exit (0 ))
330
+ Expect (status .OutputToString ()).To (Equal ("running" ))
331
+
332
+ // Clean-up
333
+ result = podmanTest .Podman ([]string {"rm" , "-t" , "0" , "-fa" })
334
+ result .WaitWithDefaultTimeout ()
335
+ Expect (result ).Should (Exit (0 ))
336
+ Expect (podmanTest .NumberOfContainersRunning ()).To (Equal (0 ))
337
+
338
+ result = podmanTest .Podman ([]string {"rmi" , checkpointImage })
339
+ result .WaitWithDefaultTimeout ()
340
+ Expect (result ).Should (Exit (0 ))
341
+ Expect (podmanTest .NumberOfContainersRunning ()).To (Equal (0 ))
342
+ })
296
343
})
0 commit comments