summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/attach_test.go1
-rw-r--r--test/e2e/common_test.go8
-rw-r--r--test/e2e/events_test.go49
-rw-r--r--test/e2e/ps_test.go25
-rw-r--r--test/e2e/run_volume_test.go5
5 files changed, 62 insertions, 26 deletions
diff --git a/test/e2e/attach_test.go b/test/e2e/attach_test.go
index 7233d169c..e9050b53b 100644
--- a/test/e2e/attach_test.go
+++ b/test/e2e/attach_test.go
@@ -33,7 +33,6 @@ var _ = Describe("Podman attach", func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
processTestResult(f)
-
})
It("podman attach to bogus container", func() {
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index 80ee83f44..e12edad49 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -21,6 +21,7 @@ import (
"github.com/containers/storage/pkg/reexec"
"github.com/containers/storage/pkg/stringid"
jsoniter "github.com/json-iterator/go"
+ "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
@@ -573,3 +574,10 @@ func (p *PodmanTestIntegration) CreateSeccompJson(in []byte) (string, error) {
}
return jsonFile, nil
}
+
+func SkipIfNotFedora() {
+ info := GetHostDistributionInfo()
+ if info.Distribution != "fedora" {
+ ginkgo.Skip("Test can only run on Fedora")
+ }
+}
diff --git a/test/e2e/events_test.go b/test/e2e/events_test.go
index 460554b77..8c496872f 100644
--- a/test/e2e/events_test.go
+++ b/test/e2e/events_test.go
@@ -5,6 +5,7 @@ import (
"fmt"
"os"
"strings"
+ "time"
. "github.com/containers/libpod/test/utils"
. "github.com/onsi/ginkgo"
@@ -24,23 +25,26 @@ var _ = Describe("Podman events", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.SeedImages()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
-
+ processTestResult(f)
})
// For most, all, of these tests we do not "live" test following a log because it may make a fragile test
// system more complex. Instead we run the "events" and then verify that the events are processed correctly.
// Perhaps a future version of this test would put events in a go func and send output back over a channel
// while events occur.
+
+ // These tests are only known to work on Fedora ATM. Other distributions
+ // will be skipped.
It("podman events", func() {
- Skip("need to verify images have correct packages for journald")
+ SkipIfRootless()
+ SkipIfNotFedora()
_, ec, _ := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))
result := podmanTest.Podman([]string{"events", "--stream=false"})
@@ -49,7 +53,8 @@ var _ = Describe("Podman events", func() {
})
It("podman events with an event filter", func() {
- Skip("need to verify images have correct packages for journald")
+ SkipIfRootless()
+ SkipIfNotFedora()
_, ec, _ := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))
result := podmanTest.Podman([]string{"events", "--stream=false", "--filter", "event=start"})
@@ -59,11 +64,14 @@ var _ = Describe("Podman events", func() {
})
It("podman events with an event filter and container=cid", func() {
- Skip("need to verify images have correct packages for journald")
+ Skip("Does not work on v2")
+ SkipIfRootless()
+ SkipIfNotFedora()
_, ec, cid := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))
_, ec2, cid2 := podmanTest.RunLsContainer("")
Expect(ec2).To(Equal(0))
+ time.Sleep(5 * time.Second)
result := podmanTest.Podman([]string{"events", "--stream=false", "--filter", "event=start", "--filter", fmt.Sprintf("container=%s", cid)})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
@@ -72,7 +80,8 @@ var _ = Describe("Podman events", func() {
})
It("podman events with a type and filter container=id", func() {
- Skip("need to verify images have correct packages for journald")
+ SkipIfRootless()
+ SkipIfNotFedora()
_, ec, cid := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))
result := podmanTest.Podman([]string{"events", "--stream=false", "--filter", "type=pod", "--filter", fmt.Sprintf("container=%s", cid)})
@@ -82,7 +91,8 @@ var _ = Describe("Podman events", func() {
})
It("podman events with a type", func() {
- Skip("need to verify images have correct packages for journald")
+ SkipIfRootless()
+ SkipIfNotFedora()
setup := podmanTest.Podman([]string{"run", "-dt", "--pod", "new:foobarpod", ALPINE, "top"})
setup.WaitWithDefaultTimeout()
stop := podmanTest.Podman([]string{"pod", "stop", "foobarpod"})
@@ -97,7 +107,8 @@ var _ = Describe("Podman events", func() {
})
It("podman events --since", func() {
- Skip("need to verify images have correct packages for journald")
+ SkipIfRootless()
+ SkipIfNotFedora()
_, ec, _ := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))
result := podmanTest.Podman([]string{"events", "--stream=false", "--since", "1m"})
@@ -106,7 +117,8 @@ var _ = Describe("Podman events", func() {
})
It("podman events --until", func() {
- Skip("need to verify images have correct packages for journald")
+ SkipIfRootless()
+ SkipIfNotFedora()
_, ec, _ := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))
test := podmanTest.Podman([]string{"events", "--help"})
@@ -118,37 +130,28 @@ var _ = Describe("Podman events", func() {
})
It("podman events format", func() {
- Skip(v2remotefail)
- info := GetHostDistributionInfo()
- if info.Distribution != "fedora" {
- Skip("need to verify images have correct packages for journald")
- }
+ SkipIfRootless()
+ SkipIfNotFedora()
_, ec, _ := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))
test := podmanTest.Podman([]string{"events", "--stream=false", "--format", "json"})
test.WaitWithDefaultTimeout()
- fmt.Println(test.OutputToStringArray())
jsonArr := test.OutputToStringArray()
Expect(len(jsonArr)).To(Not(BeZero()))
eventsMap := make(map[string]string)
err := json.Unmarshal([]byte(jsonArr[0]), &eventsMap)
- if err != nil {
- os.Exit(1)
- }
+ Expect(err).To(BeNil())
_, exist := eventsMap["Status"]
Expect(exist).To(BeTrue())
Expect(test.ExitCode()).To(BeZero())
test = podmanTest.Podman([]string{"events", "--stream=false", "--format", "{{json.}}"})
test.WaitWithDefaultTimeout()
- fmt.Println(test.OutputToStringArray())
jsonArr = test.OutputToStringArray()
Expect(len(jsonArr)).To(Not(BeZero()))
eventsMap = make(map[string]string)
err = json.Unmarshal([]byte(jsonArr[0]), &eventsMap)
- if err != nil {
- os.Exit(1)
- }
+ Expect(err).To(BeNil())
_, exist = eventsMap["Status"]
Expect(exist).To(BeTrue())
Expect(test.ExitCode()).To(BeZero())
diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go
index 8965ce297..12ce4661f 100644
--- a/test/e2e/ps_test.go
+++ b/test/e2e/ps_test.go
@@ -114,6 +114,17 @@ var _ = Describe("Podman ps", func() {
It("podman ps last flag", func() {
Skip("--last flag nonfunctional and disabled")
+ // Make sure that non-running containers are being counted as
+ // well.
+ session := podmanTest.Podman([]string{"create", "alpine", "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ result := podmanTest.Podman([]string{"ps", "--last", "2"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(len(result.OutputToStringArray())).Should(Equal(2)) // 1 container
+
_, ec, _ := podmanTest.RunLsContainer("test1")
Expect(ec).To(Equal(0))
@@ -123,10 +134,20 @@ var _ = Describe("Podman ps", func() {
_, ec, _ = podmanTest.RunLsContainer("test3")
Expect(ec).To(Equal(0))
- result := podmanTest.Podman([]string{"ps", "--last", "2"})
+ result = podmanTest.Podman([]string{"ps", "--last", "2"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(len(result.OutputToStringArray())).Should(Equal(3)) // 2 containers
+
+ result = podmanTest.Podman([]string{"ps", "--last", "3"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(len(result.OutputToStringArray())).Should(Equal(4)) // 3 containers
+
+ result = podmanTest.Podman([]string{"ps", "--last", "100"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
- Expect(len(result.OutputToStringArray())).Should(Equal(3))
+ Expect(len(result.OutputToStringArray())).Should(Equal(5)) // 4 containers (3 running + 1 created)
})
It("podman ps no-trunc", func() {
diff --git a/test/e2e/run_volume_test.go b/test/e2e/run_volume_test.go
index 58091ff68..7cd69f738 100644
--- a/test/e2e/run_volume_test.go
+++ b/test/e2e/run_volume_test.go
@@ -106,6 +106,11 @@ var _ = Describe("Podman run with volumes", func() {
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(ContainSubstring(dest + " ro"))
+ session = podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",readonly", ALPINE, "grep", dest, "/proc/self/mountinfo"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring(dest + " ro"))
+
session = podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",shared", ALPINE, "grep", dest, "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))