summaryrefslogtreecommitdiffhomepage
path: root/runsc/test/integration
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/integration
parentb4a9f186872d6687f34e609a39aa10eb33cce1d2 (diff)
Fix runsc restore to be compatible with docker start --checkpoint ...
Change-Id: I02b30de13f1393df66edf8829fedbf32405d18f8 PiperOrigin-RevId: 246621192
Diffstat (limited to 'runsc/test/integration')
-rw-r--r--runsc/test/integration/integration_test.go44
1 files changed, 44 insertions, 0 deletions
diff --git a/runsc/test/integration/integration_test.go b/runsc/test/integration/integration_test.go
index 842f05545..de17dd3c2 100644
--- a/runsc/test/integration/integration_test.go
+++ b/runsc/test/integration/integration_test.go
@@ -148,6 +148,50 @@ func TestPauseResume(t *testing.T) {
}
}
+func TestCheckpointRestore(t *testing.T) {
+ if !testutil.IsPauseResumeSupported() {
+ t.Log("Pause/resume is not supported, skipping test.")
+ return
+ }
+ if err := testutil.Pull("google/python-hello"); err != nil {
+ t.Fatal("docker pull failed:", err)
+ }
+ d := testutil.MakeDocker("save-restore-test")
+ if err := d.Run("-p", "8080", "google/python-hello"); err != nil {
+ t.Fatalf("docker run failed: %v", err)
+ }
+ defer d.CleanUp()
+
+ if err := d.Checkpoint("test"); err != nil {
+ t.Fatal("docker checkpoint failed:", err)
+ }
+
+ if _, err := d.Wait(30 * time.Second); err != nil {
+ t.Fatal(err)
+ }
+
+ if err := d.Restore("test"); err != nil {
+ t.Fatal("docker restore failed:", err)
+ }
+
+ // Find where port 8080 is mapped to.
+ port, err := d.FindPort(8080)
+ if err != nil {
+ t.Fatal("docker.FindPort(8080) failed:", err)
+ }
+
+ // Wait until it's up and running.
+ if err := testutil.WaitForHTTP(port, 30*time.Second); err != nil {
+ t.Fatal("WaitForHTTP() timeout:", err)
+ }
+
+ // Check if container is working again.
+ client := http.Client{Timeout: time.Duration(2 * time.Second)}
+ if err := httpRequestSucceeds(client, "localhost", port); err != nil {
+ t.Error("http request failed:", err)
+ }
+}
+
// Create client and server that talk to each other using the local IP.
func TestConnectToSelf(t *testing.T) {
d := testutil.MakeDocker("connect-to-self-test")