summaryrefslogtreecommitdiffhomepage
path: root/runsc/test/testutil/docker.go
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@gmail.com>2019-05-03 21:40:48 -0700
committerShentubot <shentubot@google.com>2019-05-03 21:41:45 -0700
commitbf0ac565d2873069799082ad7bc3e3c43acbc593 (patch)
tree398abb381e328568809e6e6b46a3a3a2d4034e25 /runsc/test/testutil/docker.go
parentb4a9f186872d6687f34e609a39aa10eb33cce1d2 (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.go16
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 {