summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2018-10-23 07:53:11 -0700
committerGitHub <noreply@github.com>2018-10-23 07:53:11 -0700
commit2e6bc3c7af261228ae7a75cb5749062928fa24b3 (patch)
tree94b3af23e8f5d774be0e4846698fac685a5f56f3 /test
parent79befd5158c8f01a88e4d14e46851ddcc11d51c4 (diff)
parenta14155917baa577bebbbc0c5983a7a90bf35c2b5 (diff)
downloadpodman-2e6bc3c7af261228ae7a75cb5749062928fa24b3.tar.gz
podman-2e6bc3c7af261228ae7a75cb5749062928fa24b3.tar.bz2
podman-2e6bc3c7af261228ae7a75cb5749062928fa24b3.zip
Merge pull request #1627 from adrianreber/criu
Add CRIU version check for checkpoint and restore
Diffstat (limited to 'test')
-rw-r--r--test/e2e/checkpoint_test.go7
-rw-r--r--test/e2e/libpod_suite_test.go37
2 files changed, 3 insertions, 41 deletions
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go
index 6c5d891a0..928a76324 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -4,6 +4,7 @@ import (
"fmt"
"os"
+ "github.com/containers/libpod/pkg/criu"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
@@ -22,10 +23,8 @@ var _ = Describe("Podman checkpoint", func() {
}
podmanTest = PodmanCreate(tempdir)
podmanTest.RestoreAllArtifacts()
- // At least CRIU 3.11 is needed
- skip, err := podmanTest.isCriuAtLeast(31100)
- if err != nil || skip {
- Skip("CRIU missing or too old.")
+ if !criu.CheckForCriu() {
+ Skip("CRIU is missing or too old.")
}
})
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index a032b0e88..d521632d7 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -2,7 +2,6 @@ package integration
import (
"bufio"
- "bytes"
"context"
"encoding/json"
"fmt"
@@ -65,7 +64,6 @@ type PodmanTest struct {
TempDir string
CgroupManager string
Host HostOS
- CriuBinary string
}
// HostOS is a simple struct for the test os
@@ -166,7 +164,6 @@ func PodmanCreate(tempDir string) PodmanTest {
runCBinary = "/usr/bin/runc"
}
- criuBinary := "/usr/sbin/criu"
CNIConfigDir := "/etc/cni/net.d"
p := PodmanTest{
@@ -182,7 +179,6 @@ func PodmanCreate(tempDir string) PodmanTest {
TempDir: tempDir,
CgroupManager: cgroupManager,
Host: host,
- CriuBinary: criuBinary,
}
// Setup registries.conf ENV variable
@@ -682,39 +678,6 @@ 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", "")
}