From bf0ac565d2873069799082ad7bc3e3c43acbc593 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Fri, 3 May 2019 21:40:48 -0700 Subject: Fix runsc restore to be compatible with docker start --checkpoint ... Change-Id: I02b30de13f1393df66edf8829fedbf32405d18f8 PiperOrigin-RevId: 246621192 --- runsc/test/testutil/docker.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'runsc/test/testutil') diff --git a/runsc/test/testutil/docker.go b/runsc/test/testutil/docker.go index ecd66dc77..e103e930c 100644 --- a/runsc/test/testutil/docker.go +++ b/runsc/test/testutil/docker.go @@ -263,6 +263,22 @@ func (d *Docker) Unpause() error { return nil } +// Checkpoint calls 'docker checkpoint'. +func (d *Docker) Checkpoint(name string) error { + if _, err := do("checkpoint", "create", d.Name, name); err != nil { + return fmt.Errorf("error pausing container %q: %v", d.Name, err) + } + return nil +} + +// Restore calls 'docker start --checkname [name]'. +func (d *Docker) Restore(name string) error { + if _, err := do("start", "--checkpoint", name, d.Name); err != nil { + return fmt.Errorf("error starting container %q: %v", d.Name, err) + } + return nil +} + // Remove calls 'docker rm'. func (d *Docker) Remove() error { if _, err := do("rm", d.Name); err != nil { -- cgit v1.2.3