summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/e2e/checkpoint_test.go7
-rw-r--r--test/e2e/libpod_suite_test.go45
-rw-r--r--test/e2e/logs_test.go12
-rw-r--r--test/e2e/pod_create_test.go2
-rw-r--r--test/e2e/pod_infra_container_test.go2
-rw-r--r--test/e2e/pod_top_test.go4
-rw-r--r--test/e2e/run_entrypoint_test.go8
-rw-r--r--test/e2e/run_privileged_test.go2
-rw-r--r--test/e2e/stats_test.go19
-rw-r--r--test/e2e/version_test.go2
10 files changed, 28 insertions, 75 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..56a603f3e 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
@@ -315,8 +311,14 @@ func (s *PodmanSession) OutputToString() string {
// OutputToStringArray returns the output as a []string
// where each array item is a line split by newline
func (s *PodmanSession) OutputToStringArray() []string {
+ var results []string
output := fmt.Sprintf("%s", s.Out.Contents())
- return strings.Split(output, "\n")
+ for _, line := range strings.Split(output, "\n") {
+ if line != "" {
+ results = append(results, line)
+ }
+ }
+ return results
}
// ErrorGrepString takes session stderr output and behaves like grep. it returns a bool
@@ -682,39 +684,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", "")
}
diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go
index ca39c338e..871987db0 100644
--- a/test/e2e/logs_test.go
+++ b/test/e2e/logs_test.go
@@ -42,7 +42,7 @@ var _ = Describe("Podman logs", func() {
results := podmanTest.Podman([]string{"logs", cid})
results.WaitWithDefaultTimeout()
Expect(results.ExitCode()).To(Equal(0))
- Expect(len(results.OutputToStringArray())).To(Equal(4))
+ Expect(len(results.OutputToStringArray())).To(Equal(3))
})
It("podman logs tail two lines", func() {
@@ -55,7 +55,7 @@ var _ = Describe("Podman logs", func() {
results := podmanTest.Podman([]string{"logs", "--tail", "2", cid})
results.WaitWithDefaultTimeout()
Expect(results.ExitCode()).To(Equal(0))
- Expect(len(results.OutputToStringArray())).To(Equal(3))
+ Expect(len(results.OutputToStringArray())).To(Equal(2))
})
It("podman logs tail 99 lines", func() {
@@ -68,7 +68,7 @@ var _ = Describe("Podman logs", func() {
results := podmanTest.Podman([]string{"logs", "--tail", "99", cid})
results.WaitWithDefaultTimeout()
Expect(results.ExitCode()).To(Equal(0))
- Expect(len(results.OutputToStringArray())).To(Equal(4))
+ Expect(len(results.OutputToStringArray())).To(Equal(3))
})
It("podman logs tail 2 lines with timestamps", func() {
@@ -81,7 +81,7 @@ var _ = Describe("Podman logs", func() {
results := podmanTest.Podman([]string{"logs", "--tail", "2", "-t", cid})
results.WaitWithDefaultTimeout()
Expect(results.ExitCode()).To(Equal(0))
- Expect(len(results.OutputToStringArray())).To(Equal(3))
+ Expect(len(results.OutputToStringArray())).To(Equal(2))
})
It("podman logs latest with since time", func() {
@@ -94,7 +94,7 @@ var _ = Describe("Podman logs", func() {
results := podmanTest.Podman([]string{"logs", "--since", "2017-08-07T10:10:09.056611202-04:00", cid})
results.WaitWithDefaultTimeout()
Expect(results.ExitCode()).To(Equal(0))
- Expect(len(results.OutputToStringArray())).To(Equal(4))
+ Expect(len(results.OutputToStringArray())).To(Equal(3))
})
It("podman logs latest with since duration", func() {
@@ -107,6 +107,6 @@ var _ = Describe("Podman logs", func() {
results := podmanTest.Podman([]string{"logs", "--since", "10m", cid})
results.WaitWithDefaultTimeout()
Expect(results.ExitCode()).To(Equal(0))
- Expect(len(results.OutputToStringArray())).To(Equal(4))
+ Expect(len(results.OutputToStringArray())).To(Equal(3))
})
})
diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go
index 4cf685ce2..0ce1e22a8 100644
--- a/test/e2e/pod_create_test.go
+++ b/test/e2e/pod_create_test.go
@@ -77,6 +77,6 @@ var _ = Describe("Podman pod create", func() {
check := podmanTest.Podman([]string{"pod", "ps", "-q"})
check.WaitWithDefaultTimeout()
- Expect(len(check.OutputToStringArray())).To(Equal(1))
+ Expect(len(check.OutputToStringArray())).To(Equal(0))
})
})
diff --git a/test/e2e/pod_infra_container_test.go b/test/e2e/pod_infra_container_test.go
index 8fb0c388c..f1e2375ce 100644
--- a/test/e2e/pod_infra_container_test.go
+++ b/test/e2e/pod_infra_container_test.go
@@ -155,7 +155,7 @@ var _ = Describe("Podman pod create", func() {
check.WaitWithDefaultTimeout()
Expect(check.ExitCode()).To(Equal(0))
PIDs := check.OutputToStringArray()
- Expect(len(PIDs)).To(Equal(4))
+ Expect(len(PIDs)).To(Equal(3))
ctrPID, _ := strconv.Atoi(PIDs[1])
infraPID, _ := strconv.Atoi(PIDs[2])
diff --git a/test/e2e/pod_top_test.go b/test/e2e/pod_top_test.go
index 0ecc8e6e8..f72456307 100644
--- a/test/e2e/pod_top_test.go
+++ b/test/e2e/pod_top_test.go
@@ -109,7 +109,7 @@ var _ = Describe("Podman top", func() {
result := podmanTest.Podman([]string{"pod", "top", podid})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
- Expect(len(result.OutputToStringArray())).To(Equal(4))
+ Expect(len(result.OutputToStringArray())).To(Equal(3))
})
It("podman pod top on pod with containers in different namespace", func() {
@@ -127,6 +127,6 @@ var _ = Describe("Podman top", func() {
result := podmanTest.Podman([]string{"pod", "top", podid})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
- Expect(len(result.OutputToStringArray())).To(Equal(4))
+ Expect(len(result.OutputToStringArray())).To(Equal(3))
})
})
diff --git a/test/e2e/run_entrypoint_test.go b/test/e2e/run_entrypoint_test.go
index 48ed0ce1a..5e4ef75e1 100644
--- a/test/e2e/run_entrypoint_test.go
+++ b/test/e2e/run_entrypoint_test.go
@@ -50,7 +50,7 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(len(session.OutputToStringArray())).To(Equal(3))
+ Expect(len(session.OutputToStringArray())).To(Equal(2))
})
It("podman run entrypoint with cmd", func() {
@@ -62,7 +62,7 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(len(session.OutputToStringArray())).To(Equal(5))
+ Expect(len(session.OutputToStringArray())).To(Equal(4))
})
It("podman run entrypoint with user cmd overrides image cmd", func() {
@@ -74,7 +74,7 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest", "-i"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(len(session.OutputToStringArray())).To(Equal(6))
+ Expect(len(session.OutputToStringArray())).To(Equal(5))
})
It("podman run entrypoint with user cmd no image cmd", func() {
@@ -85,7 +85,7 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest", "-i"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(len(session.OutputToStringArray())).To(Equal(6))
+ Expect(len(session.OutputToStringArray())).To(Equal(5))
})
It("podman run user entrypoint overrides image entrypoint and image cmd", func() {
diff --git a/test/e2e/run_privileged_test.go b/test/e2e/run_privileged_test.go
index 4f81c7c45..0a62d8505 100644
--- a/test/e2e/run_privileged_test.go
+++ b/test/e2e/run_privileged_test.go
@@ -75,7 +75,7 @@ var _ = Describe("Podman privileged container tests", func() {
session := podmanTest.Podman([]string{"run", "-t", "busybox", "ls", "-l", "/dev"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(len(session.OutputToStringArray())).To(Equal(18))
+ Expect(len(session.OutputToStringArray())).To(Equal(17))
})
It("podman privileged should inherit host devices", func() {
diff --git a/test/e2e/stats_test.go b/test/e2e/stats_test.go
index 8096f58b2..e456d7114 100644
--- a/test/e2e/stats_test.go
+++ b/test/e2e/stats_test.go
@@ -31,12 +31,6 @@ var _ = Describe("Podman stats", func() {
GinkgoWriter.Write([]byte(timedResult))
})
- It("podman stats should run with no containers", func() {
- session := podmanTest.Podman([]string{"stats", "--no-stream"})
- session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
- })
-
It("podman stats with bogus container", func() {
session := podmanTest.Podman([]string{"stats", "--no-stream", "123"})
session.WaitWithDefaultTimeout()
@@ -53,15 +47,6 @@ var _ = Describe("Podman stats", func() {
Expect(session.ExitCode()).To(Equal(0))
})
- It("podman stats on a running container no id", func() {
- session := podmanTest.RunTopContainer("")
- session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
- session = podmanTest.Podman([]string{"stats", "--no-stream"})
- session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
- })
-
It("podman stats on all containers", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
@@ -75,7 +60,7 @@ var _ = Describe("Podman stats", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- session = podmanTest.Podman([]string{"stats", "--no-stream", "--format", "\"{{.Container}}\""})
+ session = podmanTest.Podman([]string{"stats", "--all", "--no-stream", "--format", "\"{{.Container}}\""})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
@@ -84,7 +69,7 @@ var _ = Describe("Podman stats", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- session = podmanTest.Podman([]string{"stats", "--no-stream", "--format", "json"})
+ session = podmanTest.Podman([]string{"stats", "--all", "--no-stream", "--format", "json"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(session.IsJSONOutputValid()).To(BeTrue())
diff --git a/test/e2e/version_test.go b/test/e2e/version_test.go
index 4670c6e1e..6caf0e3dd 100644
--- a/test/e2e/version_test.go
+++ b/test/e2e/version_test.go
@@ -34,6 +34,6 @@ var _ = Describe("Podman version", func() {
session := podmanTest.Podman([]string{"version"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 3))
+ Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 2))
})
})