diff options
author | Andrei Vagin <avagin@gmail.com> | 2019-05-03 21:40:48 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-05-03 21:41:45 -0700 |
commit | bf0ac565d2873069799082ad7bc3e3c43acbc593 (patch) | |
tree | 398abb381e328568809e6e6b46a3a3a2d4034e25 /runsc/test/testutil/docker.go | |
parent | b4a9f186872d6687f34e609a39aa10eb33cce1d2 (diff) |
Fix runsc restore to be compatible with docker start --checkpoint ...
Change-Id: I02b30de13f1393df66edf8829fedbf32405d18f8
PiperOrigin-RevId: 246621192
Diffstat (limited to 'runsc/test/testutil/docker.go')
-rw-r--r-- | runsc/test/testutil/docker.go | 16 |
1 files changed, 16 insertions, 0 deletions
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 { |