summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/diff_test.go21
-rw-r--r--test/e2e/libpod_suite_test.go22
-rw-r--r--test/e2e/push_test.go2
-rw-r--r--test/e2e/restart_test.go56
-rw-r--r--test/e2e/rmi_test.go2
-rw-r--r--test/e2e/run_test.go23
-rw-r--r--test/e2e/search_test.go8
7 files changed, 118 insertions, 16 deletions
diff --git a/test/e2e/diff_test.go b/test/e2e/diff_test.go
index eca485c8b..319f086cd 100644
--- a/test/e2e/diff_test.go
+++ b/test/e2e/diff_test.go
@@ -2,6 +2,7 @@ package integration
import (
"os"
+ "sort"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -47,4 +48,24 @@ var _ = Describe("Podman diff", func() {
Expect(session.ExitCode()).To(Equal(0))
Expect(session.IsJSONOutputValid()).To(BeTrue())
})
+
+ It("podman diff container and committed image", func() {
+ session := podmanTest.Podman([]string{"run", "--name=diff-test", ALPINE, "touch", "/tmp/diff-test"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ session = podmanTest.Podman([]string{"diff", "diff-test"})
+ session.WaitWithDefaultTimeout()
+ containerDiff := session.OutputToStringArray()
+ sort.Strings(containerDiff)
+ Expect(session.LineInOutputContains("C /tmp")).To(BeTrue())
+ Expect(session.LineInOutputContains("A /tmp/diff-test")).To(BeTrue())
+ session = podmanTest.Podman([]string{"commit", "diff-test", "diff-test-img"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ session = podmanTest.Podman([]string{"diff", "diff-test-img"})
+ session.WaitWithDefaultTimeout()
+ imageDiff := session.OutputToStringArray()
+ sort.Strings(imageDiff)
+ Expect(imageDiff).To(Equal(containerDiff))
+ })
})
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index fa48334a3..1383b5a19 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -1,6 +1,7 @@
package integration
import (
+ "context"
"fmt"
"io/ioutil"
"os"
@@ -12,6 +13,7 @@ import (
"time"
"encoding/json"
+
"github.com/containers/image/copy"
"github.com/containers/image/signature"
"github.com/containers/image/storage"
@@ -109,7 +111,6 @@ var _ = BeforeSuite(func() {
}
}
for _, image := range CACHE_IMAGES {
- fmt.Printf("Caching %s...\n", image)
if err := podman.CreateArtifact(image); err != nil {
fmt.Printf("%q\n", err)
os.Exit(1)
@@ -298,6 +299,10 @@ func (p *PodmanTest) SystemExec(command string, args []string) *PodmanSession {
// CreateArtifact creates a cached image in the artifact dir
func (p *PodmanTest) CreateArtifact(image string) error {
+ if os.Getenv("NO_TEST_CACHE") != "" {
+ return nil
+ }
+ fmt.Printf("Caching %s...\n", image)
imageName := fmt.Sprintf("docker://%s", image)
systemContext := types.SystemContext{
SignaturePolicyPath: p.SignaturePolicyPath,
@@ -327,9 +332,7 @@ func (p *PodmanTest) CreateArtifact(image string) error {
return errors.Errorf("error parsing image name %v: %v", exportTo, err)
}
- return copy.Image(policyContext, exportRef, importRef, options)
-
- return nil
+ return copy.Image(getTestContext(), policyContext, exportRef, importRef, options)
}
// RestoreArtifact puts the cached image into our test store
@@ -378,7 +381,7 @@ func (p *PodmanTest) RestoreArtifact(image string) error {
}()
options := &copy.Options{}
- err = copy.Image(policyContext, ref, importRef, options)
+ err = copy.Image(getTestContext(), policyContext, ref, importRef, options)
if err != nil {
return errors.Errorf("error importing %s: %v", importFrom, err)
}
@@ -387,6 +390,9 @@ func (p *PodmanTest) RestoreArtifact(image string) error {
// RestoreAllArtifacts unpacks all cached images
func (p *PodmanTest) RestoreAllArtifacts() error {
+ if os.Getenv("NO_TEST_CACHE") != "" {
+ return nil
+ }
for _, image := range RESTORE_IMAGES {
if err := p.RestoreArtifact(image); err != nil {
return err
@@ -487,7 +493,7 @@ func (s *PodmanSession) LineInOuputStartsWith(term string) bool {
//LineInOutputContains returns true if a line in a
// session output starts with the supplied string
-func (s *PodmanSession) LineInOuputContains(term string) bool {
+func (s *PodmanSession) LineInOutputContains(term string) bool {
for _, i := range s.OutputToStringArray() {
if strings.Contains(i, term) {
return true
@@ -622,3 +628,7 @@ func IsCommandAvailable(command string) bool {
}
return true
}
+
+func getTestContext() context.Context {
+ return context.Background()
+}
diff --git a/test/e2e/push_test.go b/test/e2e/push_test.go
index 5267a66a4..46ec4ccbd 100644
--- a/test/e2e/push_test.go
+++ b/test/e2e/push_test.go
@@ -154,7 +154,7 @@ var _ = Describe("Podman push", func() {
setup := podmanTest.SystemExec("bash", []string{"-c", "systemctl status docker 2>&1"})
setup.WaitWithDefaultTimeout()
- if setup.LineInOuputContains("Active: inactive") {
+ if setup.LineInOutputContains("Active: inactive") {
setup = podmanTest.SystemExec("systemctl", []string{"start", "docker"})
setup.WaitWithDefaultTimeout()
diff --git a/test/e2e/restart_test.go b/test/e2e/restart_test.go
index ea03d022f..812ba5ac9 100644
--- a/test/e2e/restart_test.go
+++ b/test/e2e/restart_test.go
@@ -2,6 +2,7 @@ package integration
import (
"os"
+ "time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -36,10 +37,15 @@ var _ = Describe("Podman restart", func() {
It("Podman restart stopped container by name", func() {
_, exitCode, _ := podmanTest.RunLsContainer("test1")
Expect(exitCode).To(Equal(0))
+ startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1"})
+ startTime.WaitWithDefaultTimeout()
session := podmanTest.Podman([]string{"restart", "test1"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
+ restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1"})
+ restartTime.WaitWithDefaultTimeout()
+ Expect(restartTime.OutputToString()).To(Not(Equal(startTime.OutputToString())))
})
It("Podman restart stopped container by ID", func() {
@@ -47,6 +53,8 @@ var _ = Describe("Podman restart", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
cid := session.OutputToString()
+ startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", cid})
+ startTime.WaitWithDefaultTimeout()
startSession := podmanTest.Podman([]string{"start", cid})
startSession.WaitWithDefaultTimeout()
@@ -55,16 +63,24 @@ var _ = Describe("Podman restart", func() {
session2 := podmanTest.Podman([]string{"restart", cid})
session2.WaitWithDefaultTimeout()
Expect(session2.ExitCode()).To(Equal(0))
+ restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", cid})
+ restartTime.WaitWithDefaultTimeout()
+ Expect(restartTime.OutputToString()).To(Not(Equal(startTime.OutputToString())))
})
It("Podman restart running container", func() {
_ = podmanTest.RunTopContainer("test1")
ok := WaitForContainer(&podmanTest)
Expect(ok).To(BeTrue())
+ startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1"})
+ startTime.WaitWithDefaultTimeout()
- session := podmanTest.Podman([]string{"restart", "--latest"})
+ session := podmanTest.Podman([]string{"restart", "test1"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
+ restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1"})
+ restartTime.WaitWithDefaultTimeout()
+ Expect(restartTime.OutputToString()).To(Not(Equal(startTime.OutputToString())))
})
It("Podman restart multiple containers", func() {
@@ -73,9 +89,47 @@ var _ = Describe("Podman restart", func() {
_, exitCode, _ = podmanTest.RunLsContainer("test2")
Expect(exitCode).To(Equal(0))
+ startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
+ startTime.WaitWithDefaultTimeout()
session := podmanTest.Podman([]string{"restart", "test1", "test2"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
+ restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
+ restartTime.WaitWithDefaultTimeout()
+ Expect(restartTime.OutputToStringArray()[0]).To(Not(Equal(startTime.OutputToStringArray()[0])))
+ Expect(restartTime.OutputToStringArray()[1]).To(Not(Equal(startTime.OutputToStringArray()[1])))
+ })
+
+ It("Podman restart the latest container", func() {
+ _, exitCode, _ := podmanTest.RunLsContainer("test1")
+ Expect(exitCode).To(Equal(0))
+
+ _, exitCode, _ = podmanTest.RunLsContainer("test2")
+ Expect(exitCode).To(Equal(0))
+
+ startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
+ startTime.WaitWithDefaultTimeout()
+
+ session := podmanTest.Podman([]string{"restart", "-l"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
+ restartTime.WaitWithDefaultTimeout()
+ Expect(restartTime.OutputToStringArray()[0]).To(Equal(startTime.OutputToStringArray()[0]))
+ Expect(restartTime.OutputToStringArray()[1]).To(Not(Equal(startTime.OutputToStringArray()[1])))
+ })
+
+ It("Podman restart non-stop container with short timeout", func() {
+ session := podmanTest.Podman([]string{"run", "-d", "--name", "test1", "--env", "STOPSIGNAL=SIGKILL", ALPINE, "sleep", "999"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ startTime := time.Now()
+ session = podmanTest.Podman([]string{"restart", "-t", "2", "test1"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ timeSince := time.Since(startTime)
+ Expect(timeSince < 10*time.Second).To(BeTrue())
+ Expect(timeSince > 2*time.Second).To(BeTrue())
})
})
diff --git a/test/e2e/rmi_test.go b/test/e2e/rmi_test.go
index 67ccc1b95..43fe84157 100644
--- a/test/e2e/rmi_test.go
+++ b/test/e2e/rmi_test.go
@@ -80,7 +80,7 @@ var _ = Describe("Podman rmi", func() {
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
- Expect(result.LineInOuputContains(setup.OutputToString())).To(BeTrue())
+ Expect(result.LineInOutputContains(setup.OutputToString())).To(BeTrue())
})
It("podman rmi image with tags by ID cannot be done without force", func() {
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index 94a1fef57..501434852 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -302,6 +302,20 @@ var _ = Describe("Podman run", func() {
Expect(err).To(BeNil())
})
+ It("podman run with FIPS mode secrets", func() {
+ fipsFile := "/etc/system-fips"
+ err = ioutil.WriteFile(fipsFile, []byte{}, 0755)
+ Expect(err).To(BeNil())
+
+ session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "ls", "/run/secrets"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring("system-fips"))
+
+ err = os.Remove(fipsFile)
+ Expect(err).To(BeNil())
+ })
+
It("podman run without group-add", func() {
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "id"})
session.WaitWithDefaultTimeout()
@@ -316,11 +330,14 @@ var _ = Describe("Podman run", func() {
Expect(session.OutputToString()).To(Equal("uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),18(audio),20(dialout),26(tape),27(video),777,65533(nogroup)"))
})
- It("podman run with attach stdin has no output", func() {
- session := podmanTest.Podman([]string{"run", "--rm", "--attach", "stdin", ALPINE, "printenv"})
+ It("podman run with attach stdin outputs container ID", func() {
+ session := podmanTest.Podman([]string{"run", "--attach", "stdin", ALPINE, "printenv"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(session.OutputToString()).To(Equal(""))
+ ps := podmanTest.Podman([]string{"ps", "-aq", "--no-trunc"})
+ ps.WaitWithDefaultTimeout()
+ Expect(ps.ExitCode()).To(Equal(0))
+ Expect(ps.LineInOutputContains(session.OutputToString())).To(BeTrue())
})
It("podman run with attach stdout does not print stderr", func() {
diff --git a/test/e2e/search_test.go b/test/e2e/search_test.go
index fbe5a4580..5f3dd1068 100644
--- a/test/e2e/search_test.go
+++ b/test/e2e/search_test.go
@@ -32,14 +32,14 @@ var _ = Describe("Podman search", func() {
search.WaitWithDefaultTimeout()
Expect(search.ExitCode()).To(Equal(0))
Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 1))
- Expect(search.LineInOuputContains("docker.io/library/alpine")).To(BeTrue())
+ Expect(search.LineInOutputContains("docker.io/library/alpine")).To(BeTrue())
})
It("podman search registry flag", func() {
search := podmanTest.Podman([]string{"search", "--registry", "registry.fedoraproject.org", "fedora-minimal"})
search.WaitWithDefaultTimeout()
Expect(search.ExitCode()).To(Equal(0))
- Expect(search.LineInOuputContains("fedoraproject.org/fedora-minimal")).To(BeTrue())
+ Expect(search.LineInOutputContains("fedoraproject.org/fedora-minimal")).To(BeTrue())
})
It("podman search format flag", func() {
@@ -47,7 +47,7 @@ var _ = Describe("Podman search", func() {
search.WaitWithDefaultTimeout()
Expect(search.ExitCode()).To(Equal(0))
Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 1))
- Expect(search.LineInOuputContains("docker.io/library/alpine")).To(BeTrue())
+ Expect(search.LineInOutputContains("docker.io/library/alpine")).To(BeTrue())
})
It("podman search no-trunc flag", func() {
@@ -55,7 +55,7 @@ var _ = Describe("Podman search", func() {
search.WaitWithDefaultTimeout()
Expect(search.ExitCode()).To(Equal(0))
Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 1))
- Expect(search.LineInOuputContains("docker.io/library/alpine")).To(BeTrue())
+ Expect(search.LineInOutputContains("docker.io/library/alpine")).To(BeTrue())
})
It("podman search limit flag", func() {