Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: complete criu test #2520

Merged
merged 1 commit into from
Nov 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions test/cli_start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"strings"

"github.com/alibaba/pouch/test/command"
Expand Down Expand Up @@ -309,6 +310,13 @@ func (suite *PouchStartSuite) TestStartFromCheckpoint(c *check.C) {
defer os.RemoveAll(tmpDir)
checkpoint := "cp0"
command.PouchRun("checkpoint", "create", "--checkpoint-dir", tmpDir, name, checkpoint).Assert(c, icmd.Success)
// check criu image files have been dumped into checkpoint-dir, pouch create a description json,
// so there should be more than 1 files
dirs, err := ioutil.ReadDir(filepath.Join(tmpDir, checkpoint))
c.Assert(err, check.IsNil)
if len(dirs) < 2 {
c.Errorf("failed to dump criu image for container %s", name)
}

restoredContainer := "restoredContainer"
defer DelContainerForceMultyTime(c, restoredContainer)
Expand All @@ -318,6 +326,11 @@ func (suite *PouchStartSuite) TestStartFromCheckpoint(c *check.C) {
command.PouchRun("stop", restoredContainer).Assert(c, icmd.Success)

command.PouchRun("start", "--checkpoint-dir", tmpDir, "--checkpoint", checkpoint, restoredContainer).Assert(c, icmd.Success)

result := command.PouchRun("exec", restoredContainer, "sh", "-c", "ps -ef | grep top").Assert(c, icmd.Success)
if !strings.Contains(result.Stdout(), "top") {
c.Error("restored container should have top process")
}
}

// TestStartWithTty tests running container with -tty flag and attach stdin in a non-tty client.
Expand Down