summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/build/envwithtab/Dockerfile3
-rw-r--r--test/e2e/checkpoint_test.go6
-rw-r--r--test/e2e/inspect_test.go18
-rw-r--r--test/e2e/play_kube_test.go100
-rw-r--r--test/e2e/search_test.go6
5 files changed, 130 insertions, 3 deletions
diff --git a/test/e2e/build/envwithtab/Dockerfile b/test/e2e/build/envwithtab/Dockerfile
new file mode 100644
index 000000000..0d8480c04
--- /dev/null
+++ b/test/e2e/build/envwithtab/Dockerfile
@@ -0,0 +1,3 @@
+FROM alpine
+
+ENV TEST=" t"
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go
index 1c9a8dc6f..403d739f0 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -93,6 +93,12 @@ var _ = Describe("Podman checkpoint", func() {
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Exited"))
+ inspect := podmanTest.Podman([]string{"inspect", cid})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect).Should(Exit(0))
+ inspectOut := inspect.InspectContainerToJSON()
+ Expect(inspectOut[0].State.Checkpointed).To(BeTrue())
+
result = podmanTest.Podman([]string{"container", "restore", cid})
result.WaitWithDefaultTimeout()
diff --git a/test/e2e/inspect_test.go b/test/e2e/inspect_test.go
index 89859e74f..59615d009 100644
--- a/test/e2e/inspect_test.go
+++ b/test/e2e/inspect_test.go
@@ -50,6 +50,24 @@ var _ = Describe("Podman inspect", func() {
Expect(session).To(ExitWithError())
})
+ It("podman inspect filter should work if result contains tab", func() {
+ session := podmanTest.Podman([]string{"build", "--tag", "envwithtab", "build/envwithtab"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ // Verify that OS and Arch are being set
+ inspect := podmanTest.Podman([]string{"inspect", "-f", "{{ .Config.Env }}", "envwithtab"})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect).Should(Exit(0))
+ // output should not be empty
+ // test validates fix for https://github.com/containers/podman/issues/8785
+ Expect(strings.Contains(inspect.OutputToString(), "TEST"))
+
+ session = podmanTest.Podman([]string{"rmi", "envwithtab"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ })
+
It("podman inspect with GO format", func() {
session := podmanTest.Podman([]string{"inspect", "--format", "{{.ID}}", ALPINE})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index ab496f0eb..fa30f068c 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -11,6 +11,7 @@ import (
"text/template"
"time"
+ "github.com/containers/common/pkg/config"
"github.com/containers/podman/v3/pkg/util"
. "github.com/containers/podman/v3/test/utils"
"github.com/containers/storage/pkg/stringid"
@@ -30,6 +31,22 @@ metadata:
spec:
hostname: unknown
`
+var checkInfraImagePodYaml = `
+apiVersion: v1
+kind: Pod
+metadata:
+ labels:
+ app: check-infra-image
+ name: check-infra-image
+spec:
+ containers:
+ - name: alpine
+ image: quay.io/libpod/alpine:latest
+ command:
+ - sleep
+ - 24h
+status: {}
+`
var sharedNamespacePodYaml = `
apiVersion: v1
kind: Pod
@@ -1098,6 +1115,55 @@ var _ = Describe("Podman play kube", func() {
Expect(label).To(ContainSubstring("unconfined_u:system_r:spc_t:s0"))
})
+ It("podman play kube should use default infra_image", func() {
+ err := writeYaml(checkInfraImagePodYaml, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(0))
+
+ podInspect := podmanTest.Podman([]string{"inspect", "check-infra-image", "--format", "{{ .InfraContainerID }}"})
+ podInspect.WaitWithDefaultTimeout()
+ infraContainerID := podInspect.OutputToString()
+
+ conInspect := podmanTest.Podman([]string{"inspect", infraContainerID, "--format", "{{ .ImageName }}"})
+ conInspect.WaitWithDefaultTimeout()
+ infraContainerImage := conInspect.OutputToString()
+ Expect(infraContainerImage).To(Equal(config.DefaultInfraImage))
+ })
+
+ It("podman play kube should use customized infra_image", func() {
+ conffile := filepath.Join(podmanTest.TempDir, "container.conf")
+
+ infraImage := "k8s.gcr.io/pause:3.2"
+ err := ioutil.WriteFile(conffile, []byte(fmt.Sprintf("[engine]\ninfra_image=\"%s\"\n", infraImage)), 0644)
+ Expect(err).To(BeNil())
+
+ os.Setenv("CONTAINERS_CONF", conffile)
+ defer os.Unsetenv("CONTAINERS_CONF")
+
+ if IsRemote() {
+ podmanTest.RestartRemoteService()
+ }
+
+ err = writeYaml(checkInfraImagePodYaml, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(0))
+
+ podInspect := podmanTest.Podman([]string{"inspect", "check-infra-image", "--format", "{{ .InfraContainerID }}"})
+ podInspect.WaitWithDefaultTimeout()
+ infraContainerID := podInspect.OutputToString()
+
+ conInspect := podmanTest.Podman([]string{"inspect", infraContainerID, "--format", "{{ .ImageName }}"})
+ conInspect.WaitWithDefaultTimeout()
+ infraContainerImage := conInspect.OutputToString()
+ Expect(infraContainerImage).To(Equal(infraImage))
+ })
+
It("podman play kube should share ipc,net,uts when shareProcessNamespace is set", func() {
SkipIfRootless("Requires root privileges for sharing few namespaces")
err := writeYaml(sharedNamespacePodYaml, kubeYaml)
@@ -1289,6 +1355,40 @@ var _ = Describe("Podman play kube", func() {
Expect(logs.OutputToString()).To(ContainSubstring("hello world"))
})
+ It("podman pod logs test", func() {
+ SkipIfRemote("podman-remote pod logs -c is mandatory for remote machine")
+ p := getPod(withCtr(getCtr(withCmd([]string{"echo", "hello"}), withArg([]string{"world"}))))
+
+ err := generateKubeYaml("pod", p, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(0))
+
+ logs := podmanTest.Podman([]string{"pod", "logs", p.Name})
+ logs.WaitWithDefaultTimeout()
+ Expect(logs).Should(Exit(0))
+ Expect(logs.OutputToString()).To(ContainSubstring("hello world"))
+ })
+
+ It("podman-remote pod logs test", func() {
+ // -c or --container is required in podman-remote due to api limitation.
+ p := getPod(withCtr(getCtr(withCmd([]string{"echo", "hello"}), withArg([]string{"world"}))))
+
+ err := generateKubeYaml("pod", p, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(0))
+
+ logs := podmanTest.Podman([]string{"pod", "logs", "-c", getCtrNameInPod(p), p.Name})
+ logs.WaitWithDefaultTimeout()
+ Expect(logs).Should(Exit(0))
+ Expect(logs.OutputToString()).To(ContainSubstring("hello world"))
+ })
+
It("podman play kube test restartPolicy", func() {
// podName, set, expect
testSli := [][]string{
diff --git a/test/e2e/search_test.go b/test/e2e/search_test.go
index b0faabf6c..f82c3d9d1 100644
--- a/test/e2e/search_test.go
+++ b/test/e2e/search_test.go
@@ -148,7 +148,7 @@ registries = ['{{.Host}}:{{.Port}}']`
search := podmanTest.Podman([]string{"search", "docker.io/alpine"})
search.WaitWithDefaultTimeout()
Expect(search).Should(Exit(0))
- Expect(len(search.OutputToStringArray())).To(Equal(26))
+ Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 10))
search = podmanTest.Podman([]string{"search", "--limit", "3", "docker.io/alpine"})
search.WaitWithDefaultTimeout()
@@ -462,7 +462,7 @@ registries = ['{{.Host}}:{{.Port}}']`
search = podmanTest.Podman([]string{"search", "--list-tags", "docker.io/library/alpine"})
search.WaitWithDefaultTimeout()
Expect(search).Should(Exit(0))
- Expect(len(search.OutputToStringArray()) > 2).To(BeTrue())
+ Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 2))
search = podmanTest.Podman([]string{"search", "--filter=is-official", "--list-tags", "docker.io/library/alpine"})
search.WaitWithDefaultTimeout()
@@ -477,6 +477,6 @@ registries = ['{{.Host}}:{{.Port}}']`
search := podmanTest.Podman([]string{"search", "--limit", "130", "registry.redhat.io/rhel"})
search.WaitWithDefaultTimeout()
Expect(search).Should(Exit(0))
- Expect(len(search.OutputToStringArray())).To(Equal(131))
+ Expect(len(search.OutputToStringArray())).To(BeNumerically("<=", 131))
})
})