diff options
author | Adrian Reber <areber@redhat.com> | 2018-09-20 13:46:50 +0000 |
---|---|---|
committer | Adrian Reber <adrian@lisas.de> | 2018-10-03 21:41:40 +0200 |
commit | 5246238e7efbf9280e07f45df9ee14ecc3404f20 (patch) | |
tree | 48a652f93e71646b025d511a47e97662ef706d8a /test/e2e/libpod_suite_test.go | |
parent | 5bafafc7eb31152b12627a1bf07657013ee01027 (diff) | |
download | podman-5246238e7efbf9280e07f45df9ee14ecc3404f20.tar.gz podman-5246238e7efbf9280e07f45df9ee14ecc3404f20.tar.bz2 podman-5246238e7efbf9280e07f45df9ee14ecc3404f20.zip |
tests: add checkpoint/restore test
Signed-off-by: Adrian Reber <areber@redhat.com>
Diffstat (limited to 'test/e2e/libpod_suite_test.go')
-rw-r--r-- | test/e2e/libpod_suite_test.go | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go index d521632d7..a032b0e88 100644 --- a/test/e2e/libpod_suite_test.go +++ b/test/e2e/libpod_suite_test.go @@ -2,6 +2,7 @@ package integration import ( "bufio" + "bytes" "context" "encoding/json" "fmt" @@ -64,6 +65,7 @@ type PodmanTest struct { TempDir string CgroupManager string Host HostOS + CriuBinary string } // HostOS is a simple struct for the test os @@ -164,6 +166,7 @@ func PodmanCreate(tempDir string) PodmanTest { runCBinary = "/usr/bin/runc" } + criuBinary := "/usr/sbin/criu" CNIConfigDir := "/etc/cni/net.d" p := PodmanTest{ @@ -179,6 +182,7 @@ func PodmanCreate(tempDir string) PodmanTest { TempDir: tempDir, CgroupManager: cgroupManager, Host: host, + CriuBinary: criuBinary, } // Setup registries.conf ENV variable @@ -678,6 +682,39 @@ func (p *PodmanTest) setRegistriesConfigEnv(b []byte) { ioutil.WriteFile(outfile, b, 0644) } +func (p *PodmanTest) isCriuAtLeast(version int) (bool, error) { + cmd := exec.Command(p.CriuBinary, "-V") + var out bytes.Buffer + cmd.Stdout = &out + err := cmd.Run() + if err != nil { + return false, err + } + + var x int + var y int + var z int + + fmt.Sscanf(out.String(), "Version: %d.%d.%d", &x, &y, &z) + + if strings.Contains(out.String(), "GitID") { + // If CRIU is built from git it contains a git ID. + // If that is the case, increase minor by one as this + // could mean we are running a development version. + y = y + 1 + } + + parsed_version := x*10000 + y*100 + z + + fmt.Println(parsed_version) + + if parsed_version >= version { + return false, nil + } else { + return true, nil + } +} + func resetRegistriesConfigEnv() { os.Setenv("REGISTRIES_CONFIG_PATH", "") } |