diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go index f87a0b5218..7852f5b27b 100644 --- a/test/e2e/play_kube_test.go +++ b/test/e2e/play_kube_test.go @@ -67,7 +67,9 @@ metadata: spec: containers: - name: myctr - image: quay.io/libpod/alpine_nginx:latest + image: ` + CITEST_IMAGE + ` + command: + - top volumeMounts: - name: foo mountPath: /etc/foo @@ -87,7 +89,9 @@ metadata: spec: containers: - name: myctr - image: quay.io/libpod/alpine_nginx:latest + image: ` + CITEST_IMAGE + ` + command: + - top volumeMounts: - name: foo mountPath: /etc/foo @@ -121,7 +125,9 @@ metadata: spec: containers: - name: myctr - image: quay.io/libpod/alpine_nginx:latest + image: ` + CITEST_IMAGE + ` + command: + - top volumeMounts: - name: foo mountPath: /etc/foo @@ -141,7 +147,9 @@ metadata: spec: containers: - name: myctr - image: quay.io/libpod/alpine_nginx:latest + image: ` + CITEST_IMAGE + ` + command: + - top volumeMounts: - name: foo mountPath: /etc/foo @@ -161,7 +169,9 @@ metadata: spec: containers: - name: myctr - image: quay.io/libpod/alpine_nginx:latest + image: ` + CITEST_IMAGE + ` + command: + - top volumeMounts: - name: foo mountPath: /etc/foo @@ -180,7 +190,9 @@ metadata: spec: containers: - name: myctr - image: quay.io/libpod/alpine_nginx:latest + image: ` + CITEST_IMAGE + ` + command: + - top volumeMounts: - name: foo mountPath: /etc/foo @@ -197,7 +209,7 @@ metadata: name: libpod-test spec: containers: - - image: quay.io/libpod/alpine_nginx:latest + - image: ` + CITEST_IMAGE + ` command: - sleep - "3600"` @@ -236,7 +248,7 @@ metadata: spec: containers: - name: podnameEqualsContainerNameYaml - image: quay.io/libpod/alpine:latest + image: ` + CITEST_IMAGE + ` ` var podWithoutAName = ` @@ -245,7 +257,7 @@ kind: Pod spec: containers: - name: podDoesntHaveAName - image: quay.io/libpod/alpine:latest + image: ` + CITEST_IMAGE + ` ports: - containerPort: 80 ` @@ -258,7 +270,7 @@ metadata: spec: containers: - name: testctr - image: quay.io/libpod/alpine_nginx:latest + image: ` + CITEST_IMAGE + ` command: - sleep - inf @@ -281,8 +293,8 @@ metadata: name: check-infra-image spec: containers: - - name: alpine - image: quay.io/libpod/alpine:latest + - name: testimage + image: ` + CITEST_IMAGE + ` command: - sleep - 24h @@ -296,8 +308,8 @@ metadata: name: testpod1 spec: containers: - - name: alpine - image: quay.io/libpod/alpine:latest + - name: testimage + image: ` + CITEST_IMAGE + ` volumeMounts: - name: mycm mountPath: /mycm @@ -324,8 +336,8 @@ spec: env: - name: HOSTNAME value: label-pod - image: quay.io/libpod/alpine:latest - name: alpine + image: ` + CITEST_IMAGE + ` + name: testimage resources: {} securityContext: allowPrivilegeEscalation: true @@ -345,24 +357,24 @@ kind: Deployment metadata: name: liveness-probe labels: - app: alpine + app: testimage spec: replicas: 1 selector: matchLabels: - app: alpine + app: testimage template: metadata: labels: - app: alpine + app: testimage spec: containers: - command: - top - -d - "1.5" - name: alpine - image: quay.io/libpod/alpine:latest + name: testimage + image: ` + CITEST_IMAGE + ` livenessProbe: exec: command: @@ -377,16 +389,16 @@ kind: Deployment metadata: name: liveness-unhealthy-probe labels: - app: alpine + app: testimage spec: replicas: 1 selector: matchLabels: - app: alpine + app: testimage template: metadata: labels: - app: alpine + app: testimage spec: restartPolicy: Never containers: @@ -394,8 +406,8 @@ spec: - top - -d - "1.5" - name: alpine - image: quay.io/libpod/alpine:latest + name: testimage + image: ` + CITEST_IMAGE + ` livenessProbe: exec: command: @@ -411,16 +423,16 @@ kind: Deployment metadata: name: startup-healthy-probe labels: - app: alpine + app: testimage spec: replicas: 1 selector: matchLabels: - app: alpine + app: testimage template: metadata: labels: - app: alpine + app: testimage spec: restartPolicy: Never containers: @@ -428,8 +440,8 @@ spec: - top - -d - "1.5" - name: alpine - image: quay.io/libpod/alpine:latest + name: testimage + image: ` + CITEST_IMAGE + ` startupProbe: exec: command: @@ -464,7 +476,7 @@ spec: env: - name: HOSTNAME value: label-pod - image: quay.io/libpod/alpine:latest + image: ` + CITEST_IMAGE + ` name: test securityContext: allowPrivilegeEscalation: true @@ -1039,7 +1051,8 @@ metadata: spec: containers: - name: nginx - image: quay.io/libpod/alpine_nginx:latest + image: ` + NGINX_IMAGE + ` + imagePullPolicy: missing ` var publishPortsPodWithContainerPort = ` @@ -1050,7 +1063,8 @@ metadata: spec: containers: - name: nginx - image: quay.io/libpod/alpine_nginx:latest + image: ` + NGINX_IMAGE + ` + imagePullPolicy: missing ports: - containerPort: 80 ` @@ -1063,7 +1077,8 @@ metadata: spec: containers: - name: nginx - image: quay.io/libpod/alpine_nginx:latest + image: ` + NGINX_IMAGE + ` + imagePullPolicy: missing ports: - containerPort: 80 hostPort: 19001 @@ -1077,7 +1092,7 @@ metadata: spec: containers: - name: udp-echo - image: quay.io/libpod/busybox:latest + image: ` + CITEST_IMAGE + ` command: - "/bin/sh" - "-c" @@ -1087,7 +1102,7 @@ spec: hostPort: 19009 protocol: udp - name: tcp-echo - image: quay.io/libpod/busybox:latest + image: ` + CITEST_IMAGE + ` command: - "/bin/sh" - "-c" @@ -1102,13 +1117,13 @@ metadata: spec: containers: - name: udp-echo - image: quay.io/libpod/busybox:latest + image: ` + CITEST_IMAGE + ` command: - "/bin/sh" - "-c" - "nc -ulk -p 19008 -e /bin/cat" - name: tcp-echo - image: quay.io/libpod/busybox:latest + image: ` + CITEST_IMAGE + ` command: - "/bin/sh" - "-c" @@ -1127,8 +1142,8 @@ metadata: spec: hostPID: true containers: - - name: alpine - image: quay.io/libpod/alpine:latest + - name: testimage + image: ` + CITEST_IMAGE + ` command: ['sh', '-c', 'echo $$'] ` @@ -1140,8 +1155,8 @@ metadata: spec: hostIPC: true containers: - - name: alpine - image: quay.io/libpod/alpine:latest + - name: testimage + image: ` + CITEST_IMAGE + ` command: ['ls', '-l', '/proc/self/ns/ipc'] restartPolicy: Never ` @@ -1159,8 +1174,8 @@ spec: - name: net.core.somaxconn value: "65535" containers: - - name: alpine - image: quay.io/libpod/alpine:latest + - name: testimage + image: ` + CITEST_IMAGE + ` command: - "/bin/sh" - "-c" @@ -1182,8 +1197,8 @@ spec: value: "65535" hostNetwork: true containers: - - name: alpine - image: quay.io/libpod/alpine:latest + - name: testimage + image: ` + CITEST_IMAGE + ` command: - "/bin/sh" - "-c" @@ -1207,7 +1222,7 @@ items: spec: containers: - name: container - image: quay.io/libpod/alpine:latest + image: ` + CITEST_IMAGE + ` command: [ "/bin/sh", "-c", "env" ] env: - name: FOO @@ -1222,7 +1237,7 @@ var ( defaultCtrName = "testCtr" defaultCtrCmd = []string{"top"} defaultCtrArg = []string{"-d", "1.5"} - defaultCtrImage = ALPINE + defaultCtrImage = CITEST_IMAGE defaultPodName = "testPod" defaultVolName = "testVol" defaultDaemonSetName = "testDaemonSet" @@ -1300,7 +1315,7 @@ func createSecret(podmanTest *PodmanTestIntegration, name string, value []byte) secret := podmanTest.Podman([]string{"secret", "create", name, secretFilePath}) secret.WaitWithDefaultTimeout() - Expect(secret).Should(Exit(0)) + Expect(secret).Should(ExitCleanly()) } // Secret describes the options a kube yaml can be configured at secret level @@ -1667,7 +1682,7 @@ func getCtr(options ...ctrOption) *Ctr { Caps: false, CapAdd: nil, CapDrop: nil, - PullPolicy: "", + PullPolicy: "missing", HostIP: "", Port: "", VolumeMount: false, @@ -1976,44 +1991,44 @@ func createAndTestSecret(podmanTest *PodmanTestIntegration, secretYamlString, se err := writeYaml(secretYamlString, fileName) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", fileName}) + kube := podmanTest.Podman([]string{"kube", "play", fileName}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) secretList := podmanTest.Podman([]string{"secret", "list"}) secretList.WaitWithDefaultTimeout() - Expect(secretList).Should(Exit(0)) + Expect(secretList).Should(ExitCleanly()) Expect(secretList.OutputToString()).Should(ContainSubstring(secretName)) // test if secret ID is printed once created secretListQuiet := podmanTest.Podman([]string{"secret", "list", "--quiet"}) secretListQuiet.WaitWithDefaultTimeout() - Expect(secretListQuiet).Should(Exit(0)) + Expect(secretListQuiet).Should(ExitCleanly()) Expect(kube.OutputToString()).Should(ContainSubstring(secretListQuiet.OutputToString())) } func deleteAndTestSecret(podmanTest *PodmanTestIntegration, secretName string) { secretRm := podmanTest.Podman([]string{"secret", "rm", secretName}) secretRm.WaitWithDefaultTimeout() - Expect(secretRm).Should(Exit(0)) + Expect(secretRm).Should(ExitCleanly()) } func testPodWithSecret(podmanTest *PodmanTestIntegration, podYamlString, fileName string, succeed, exists bool) { err := writeYaml(podYamlString, fileName) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", fileName}) + kube := podmanTest.Podman([]string{"kube", "play", fileName}) kube.WaitWithDefaultTimeout() if !succeed { Expect(kube).Should(Exit(-1)) return } - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) exec := podmanTest.Podman([]string{"exec", "mypod-myctr", "cat", "/etc/foo/username"}) exec.WaitWithDefaultTimeout() if exists { - Expect(exec).Should(Exit(0)) + Expect(exec).Should(ExitCleanly()) username, _ := base64.StdEncoding.DecodeString("dXNlcg==") Expect(exec.OutputToString()).Should(ContainSubstring(string(username))) } else { @@ -2022,7 +2037,7 @@ func testPodWithSecret(podmanTest *PodmanTestIntegration, podYamlString, fileNam podRm := podmanTest.Podman([]string{"pod", "rm", "-f", "mypod"}) podRm.WaitWithDefaultTimeout() - Expect(podRm).Should(Exit(0)) + Expect(podRm).Should(ExitCleanly()) } func testHTTPServer(port string, shouldErr bool, expectedResponse string) { @@ -2057,26 +2072,26 @@ func testHTTPServer(port string, shouldErr bool, expectedResponse string) { func verifyPodPorts(podmanTest *PodmanTestIntegration, podName string, ports ...string) { podInspect := podmanTest.Podman([]string{"pod", "inspect", podName, "--format", "{{.InfraContainerID}}"}) podInspect.WaitWithDefaultTimeout() - Expect(podInspect).To(Exit(0)) + Expect(podInspect).To(ExitCleanly()) infraID := podInspect.OutputToString() inspect := podmanTest.Podman([]string{"inspect", "--format", "{{.NetworkSettings.Ports}}", infraID}) inspect.WaitWithDefaultTimeout() - Expect(inspect).To(Exit(0)) + Expect(inspect).To(ExitCleanly()) for _, port := range ports { Expect(inspect.OutputToString()).Should(ContainSubstring(port)) } } -var _ = Describe("Podman play kube", func() { +var _ = Describe("Podman kube play", func() { var kubeYaml string BeforeEach(func() { kubeYaml = filepath.Join(podmanTest.TempDir, "kube.yaml") }) - It("podman play kube fail with yaml of unsupported kind", func() { + It("[play kube] fail with yaml of unsupported kind", func() { err := writeYaml(unknownKindYaml, kubeYaml) Expect(err).ToNot(HaveOccurred()) @@ -2086,16 +2101,16 @@ var _ = Describe("Podman play kube", func() { }) - It("podman play kube fail with custom selinux label", func() { + It("fail with custom selinux label", func() { if !selinux.GetEnabled() { Skip("SELinux not enabled") } err := writeYaml(selinuxLabelPodYaml, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", "label-pod-test", "--format", "'{{ .ProcessLabel }}'"}) inspect.WaitWithDefaultTimeout() @@ -2104,17 +2119,17 @@ var _ = Describe("Podman play kube", func() { Expect(label).To(ContainSubstring("unconfined_u:system_r:spc_t:s0")) }) - It("podman play kube --no-host", func() { + It("--no-host", func() { err := writeYaml(checkInfraImagePodYaml, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", "--no-hosts", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", "--no-hosts", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) podInspect := podmanTest.Podman([]string{"pod", "inspect", "check-infra-image"}) podInspect.WaitWithDefaultTimeout() - Expect(podInspect).Should(Exit(0)) + Expect(podInspect).Should(ExitCleanly()) data := podInspect.InspectPodToJSON() for _, ctr := range data.Containers { @@ -2123,22 +2138,22 @@ var _ = Describe("Podman play kube", func() { } exec := podmanTest.Podman([]string{"exec", ctr.ID, "cat", "/etc/hosts"}) exec.WaitWithDefaultTimeout() - Expect(exec).Should(Exit(0)) + Expect(exec).Should(ExitCleanly()) Expect(exec.OutputToString()).To(Not(ContainSubstring("check-infra-image"))) } }) - It("podman play kube with non-existing configmap", func() { + It("with non-existing configmap", func() { err := writeYaml(podWithoutConfigMapDefined, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).Should(Exit(125)) Expect(kube.ErrorToString()).To(ContainSubstring("failed to create volume \"mycm\": no such ConfigMap \"mycm\"")) }) - It("podman play kube test HostAliases with --no-hosts", func() { + It("test HostAliases with --no-hosts", func() { pod := getPod(withHostAliases("192.168.1.2", []string{ "test1.podman.io", "test2.podman.io", @@ -2151,13 +2166,13 @@ var _ = Describe("Podman play kube", func() { err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", "--no-hosts", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", "--no-hosts", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).Should(Exit(125)) Expect(kube.ErrorToString()).To(ContainSubstring("HostAliases in yaml file will not work with --no-hosts")) }) - It("podman play kube should use customized infra_image", func() { + It("should use customized infra_image", func() { conffile := filepath.Join(podmanTest.TempDir, "container.conf") infraImage := "registry.k8s.io/pause:3.2" @@ -2173,9 +2188,9 @@ var _ = Describe("Podman play kube", func() { err = writeYaml(checkInfraImagePodYaml, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) podInspect := podmanTest.Podman([]string{"inspect", "check-infra-image", "--format", "{{ .InfraContainerID }}"}) podInspect.WaitWithDefaultTimeout() @@ -2187,14 +2202,14 @@ var _ = Describe("Podman play kube", func() { Expect(infraContainerImage).To(Equal(infraImage)) }) - It("podman play kube should share ipc,net,uts when shareProcessNamespace is set", func() { + It("should share ipc,net,uts when shareProcessNamespace is set", func() { SkipIfRootless("Requires root privileges for sharing few namespaces") err := writeYaml(sharedNamespacePodYaml, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", "testpod1", "--format", "'{{ .SharedNamespaces }}'"}) inspect.WaitWithDefaultTimeout() @@ -2205,42 +2220,42 @@ var _ = Describe("Podman play kube", func() { Expect(sharednamespaces).To(ContainSubstring("pid")) }) - It("podman play kube should be able to run image where workdir is a symlink", func() { + It("should be able to run image where workdir is a symlink", func() { session := podmanTest.Podman([]string{ "build", "-f", "build/workdir-symlink/Dockerfile", "-t", "test-symlink", }) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) err := writeYaml(workdirSymlinkPodYaml, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) wait := podmanTest.Podman([]string{"wait", "test-symlink-test-symlink"}) wait.WaitWithDefaultTimeout() - Expect(wait).Should(Exit(0)) + Expect(wait).Should(ExitCleanly()) Expect(wait.OutputToString()).To(Equal("0")) logs := podmanTest.Podman([]string{"pod", "logs", "-c", "test-symlink-test-symlink", "test-symlink"}) logs.WaitWithDefaultTimeout() - Expect(logs).Should(Exit(0)) + Expect(logs).Should(ExitCleanly()) Expect(logs.OutputToString()).To(ContainSubstring("hello")) }) - It("podman play kube should not rename pod if container in pod has same name", func() { + It("should not rename pod if container in pod has same name", func() { err := writeYaml(podnameEqualsContainerNameYaml, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) testPodCreated := podmanTest.Podman([]string{"pod", "exists", "podnameEqualsContainerNameYaml"}) testPodCreated.WaitWithDefaultTimeout() - Expect(testPodCreated).Should(Exit(0)) + Expect(testPodCreated).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", "podnameEqualsContainerNameYaml"}) inspect.WaitWithDefaultTimeout() @@ -2253,54 +2268,54 @@ var _ = Describe("Podman play kube", func() { Expect(containerNames).To(ContainElement("podnameEqualsContainerNameYaml-podnameEqualsContainerNameYaml")) }) - It("podman play kube should error if pod dont have a name", func() { + It("should error if pod dont have a name", func() { err := writeYaml(podWithoutAName, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).Should(Exit(125)) }) - It("podman play kube support container liveness probe", func() { + It("support container liveness probe", func() { err := writeYaml(livenessProbePodYaml, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) - inspect := podmanTest.Podman([]string{"inspect", "liveness-probe-pod-alpine", "--format", "'{{ .Config.Healthcheck }}'"}) + inspect := podmanTest.Podman([]string{"inspect", "liveness-probe-pod-testimage", "--format", "'{{ .Config.Healthcheck }}'"}) inspect.WaitWithDefaultTimeout() healthcheckcmd := inspect.OutputToString() // check if CMD-SHELL based equivalent health check is added to container Expect(healthcheckcmd).To(ContainSubstring("[CMD echo hello]")) }) - It("podman play kube liveness probe should fail", func() { + It("liveness probe should fail", func() { err := writeYaml(livenessProbeUnhealthyPodYaml, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) time.Sleep(2 * time.Second) - hc := podmanTest.Podman([]string{"healthcheck", "run", "liveness-unhealthy-probe-pod-alpine"}) + hc := podmanTest.Podman([]string{"healthcheck", "run", "liveness-unhealthy-probe-pod-testimage"}) hc.WaitWithDefaultTimeout() hcoutput := hc.OutputToString() Expect(hcoutput).To(ContainSubstring(define.HealthCheckUnhealthy)) }) - It("podman play kube support container startup probe", func() { - ctrName := "startup-healthy-probe-pod-alpine" + It("support container startup probe", func() { + ctrName := "startup-healthy-probe-pod-testimage" err := writeYaml(startupProbePodYaml, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) time.Sleep(2 * time.Second) inspect := podmanTest.InspectContainer(ctrName) @@ -2312,43 +2327,43 @@ var _ = Describe("Podman play kube", func() { exec := podmanTest.Podman([]string{"exec", ctrName, "sh", "-c", "echo 'startup probe success' > /testfile"}) exec.WaitWithDefaultTimeout() - Expect(exec).Should(Exit(0)) + Expect(exec).Should(ExitCleanly()) hc = podmanTest.Podman([]string{"healthcheck", "run", ctrName}) hc.WaitWithDefaultTimeout() - Expect(hc).Should(Exit(0)) + Expect(hc).Should(ExitCleanly()) inspect = podmanTest.InspectContainer(ctrName) Expect(inspect[0].State.Health).To(HaveField("Status", define.HealthCheckHealthy)) }) - It("podman play kube fail with nonexistent authfile", func() { + It("fail with nonexistent authfile", func() { err := generateKubeYaml("pod", getPod(), kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", "--authfile", "/tmp/nonexistent", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", "--authfile", "/tmp/nonexistent", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).To(ExitWithError()) }) - It("podman play kube test correct command", func() { + It("test correct command", func() { pod := getPod() err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Cmd }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) cmd := inspect.OutputToString() inspect = podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Entrypoint }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) ep := inspect.OutputToString() // Use the defined command to override the image's command @@ -2357,64 +2372,64 @@ var _ = Describe("Podman play kube", func() { }) // If you do not supply command or args for a Container, the defaults defined in the Docker image are used. - It("podman play kube test correct args and cmd when not specified", func() { + It("test correct args and cmd when not specified", func() { pod := getPod(withCtr(getCtr(withImage(REGISTRY_IMAGE), withCmd(nil), withArg(nil)))) err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) // this image's ENTRYPOINT is `/entrypoint.sh` inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Entrypoint }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(`/entrypoint.sh`)) // and its COMMAND is `/etc/docker/registry/config.yml` inspect = podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Cmd }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(`[/etc/docker/registry/config.yml]`)) }) // If you supply a command but no args for a Container, only the supplied command is used. // The default EntryPoint and the default Cmd defined in the Docker image are ignored. - It("podman play kube test correct command with only set command in yaml file", func() { + It("test correct command with only set command in yaml file", func() { pod := getPod(withCtr(getCtr(withImage(REGISTRY_IMAGE), withCmd([]string{"echo", "hello"}), withArg(nil)))) err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) // Use the defined command to override the image's command, and don't set the args // so the full command in result should not contains the image's command inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Entrypoint }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(`echo hello`)) inspect = podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Cmd }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) // an empty command is reported as '[]' Expect(inspect.OutputToString()).To(ContainSubstring(`[]`)) }) - // If you have an init container in the pod yaml, podman should create and run the init container with play kube + // If you have an init container in the pod yaml, podman should create and run the init container with kube play // With annotation set to always - It("podman play kube test with init containers and annotation set", func() { + It("test with init containers and annotation set", func() { // With the init container type annotation set to always - pod := getPod(withAnnotation("io.podman.annotations.init.container.type", "always"), withPodInitCtr(getCtr(withImage(ALPINE), withCmd([]string{"printenv", "container"}), withInitCtr(), withName("init-test"))), withCtr(getCtr(withImage(ALPINE), withCmd([]string{"top"})))) + pod := getPod(withAnnotation("io.podman.annotations.init.container.type", "always"), withPodInitCtr(getCtr(withImage(CITEST_IMAGE), withCmd([]string{"printenv", "container"}), withInitCtr(), withName("init-test"))), withCtr(getCtr(withImage(CITEST_IMAGE), withCmd([]string{"top"})))) err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) // Expect the number of containers created to be 3, one init, infra, and regular container numOfCtrs := podmanTest.NumberOfContainers() @@ -2423,39 +2438,39 @@ var _ = Describe("Podman play kube", func() { // Init container should have exited after running inspect := podmanTest.Podman([]string{"inspect", "--format", "{{.State.Status}}", "testPod-init-test"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring("exited")) // Regular container should be in running state inspect = podmanTest.Podman([]string{"inspect", "--format", "{{.State.Status}}", "testPod-" + defaultCtrName}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring("running")) // Init containers should not be restarted inspect = podmanTest.Podman([]string{"inspect", "--format", "{{ .HostConfig.RestartPolicy.Name }}", "testPod-" + defaultCtrName}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(define.RestartPolicyNo)) // Init containers need environment too! #18384 logs := podmanTest.Podman([]string{"logs", "testPod-init-test"}) logs.WaitWithDefaultTimeout() - Expect(logs).Should(Exit(0)) + Expect(logs).Should(ExitCleanly()) Expect(logs.OutputToString()).To(Equal("podman")) }) - // If you have an init container in the pod yaml, podman should create and run the init container with play kube + // If you have an init container in the pod yaml, podman should create and run the init container with kube play // Using default init container type (once) - It("podman play kube test with init container type set to default value", func() { + It("test with init container type set to default value", func() { // Using the default init container type (once) - pod := getPod(withPodInitCtr(getCtr(withImage(ALPINE), withCmd([]string{"echo", "hello"}), withInitCtr(), withName("init-test"))), withCtr(getCtr(withImage(ALPINE), withCmd([]string{"top"})))) + pod := getPod(withPodInitCtr(getCtr(withImage(CITEST_IMAGE), withCmd([]string{"echo", "hello"}), withInitCtr(), withName("init-test"))), withCtr(getCtr(withImage(CITEST_IMAGE), withCmd([]string{"top"})))) err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) // Expect the number of containers created to be 2, infra and regular container numOfCtrs := podmanTest.NumberOfContainers() @@ -2464,74 +2479,74 @@ var _ = Describe("Podman play kube", func() { // Regular container should be in running state inspect := podmanTest.Podman([]string{"inspect", "--format", "{{.State.Status}}", "testPod-" + defaultCtrName}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring("running")) }) // If you supply only args for a Container, the default Entrypoint defined in the Docker image is run with the args that you supplied. - It("podman play kube test correct command with only set args in yaml file", func() { + It("test correct command with only set args in yaml file", func() { pod := getPod(withCtr(getCtr(withImage(REGISTRY_IMAGE), withCmd(nil), withArg([]string{"echo", "hello"})))) err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) // this image's ENTRYPOINT is `/entrypoint.sh` inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Entrypoint }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(`/entrypoint.sh`)) inspect = podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Cmd }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(`[echo hello]`)) }) // If you supply a command and args, // the default Entrypoint and the default Cmd defined in the Docker image are ignored. // Your command is run with your args. - It("podman play kube test correct command with both set args and cmd in yaml file", func() { + It("test correct command with both set args and cmd in yaml file", func() { pod := getPod(withCtr(getCtr(withImage(REGISTRY_IMAGE), withCmd([]string{"echo"}), withArg([]string{"hello"})))) err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Entrypoint }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(`echo`)) inspect = podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Cmd }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(`[hello]`)) }) - It("podman play kube test correct output", func() { + It("test correct output", func() { p := getPod(withCtr(getCtr(withCmd([]string{"echo", "hello"}), withArg([]string{"world"})))) err := generateKubeYaml("pod", p, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) wait := podmanTest.Podman([]string{"wait", getCtrNameInPod(p)}) wait.WaitWithDefaultTimeout() - Expect(wait).Should(Exit(0)) + Expect(wait).Should(ExitCleanly()) // Flake prevention: journalctl makes no timeliness guarantees. time.Sleep(1 * time.Second) logs := podmanTest.Podman([]string{"logs", getCtrNameInPod(p)}) logs.WaitWithDefaultTimeout() - Expect(logs).Should(Exit(0)) + Expect(logs).Should(ExitCleanly()) Expect(logs.OutputToString()).To(ContainSubstring("hello world")) }) @@ -2542,17 +2557,17 @@ var _ = Describe("Podman play kube", func() { err := generateKubeYaml("pod", p, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) wait := podmanTest.Podman([]string{"wait", getCtrNameInPod(p)}) wait.WaitWithDefaultTimeout() - Expect(wait).Should(Exit(0)) + Expect(wait).Should(ExitCleanly()) logs := podmanTest.Podman([]string{"pod", "logs", p.Name}) logs.WaitWithDefaultTimeout() - Expect(logs).Should(Exit(0)) + Expect(logs).Should(ExitCleanly()) Expect(logs.OutputToString()).To(ContainSubstring("hello world")) }) @@ -2563,21 +2578,21 @@ var _ = Describe("Podman play kube", func() { err := generateKubeYaml("pod", p, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) wait := podmanTest.Podman([]string{"wait", getCtrNameInPod(p)}) wait.WaitWithDefaultTimeout() - Expect(wait).Should(Exit(0)) + Expect(wait).Should(ExitCleanly()) logs := podmanTest.Podman([]string{"pod", "logs", "-c", getCtrNameInPod(p), p.Name}) logs.WaitWithDefaultTimeout() - Expect(logs).Should(Exit(0)) + Expect(logs).Should(ExitCleanly()) Expect(logs.OutputToString()).To(ContainSubstring("hello world")) }) - It("podman play kube test restartPolicy", func() { + It("test restartPolicy", func() { // podName, set, expect testSli := [][]string{ {"testPod1", "", "always"}, // Default equal to always @@ -2590,18 +2605,18 @@ var _ = Describe("Podman play kube", func() { err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", pod.Name, "--format", "{{.RestartPolicy}}"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(Equal(v[2])) } }) - It("podman play kube test env value from configmap", func() { + It("test env value from configmap", func() { cmYamlPathname := filepath.Join(podmanTest.TempDir, "foo-cm.yaml") cm := getConfigMap(withConfigMapName("foo"), withConfigMapData("FOO", "foo")) err := generateKubeYaml("configmap", cm, cmYamlPathname) @@ -2611,17 +2626,17 @@ var _ = Describe("Podman play kube", func() { err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml, "--configmap", cmYamlPathname}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml, "--configmap", cmYamlPathname}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Env }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(`FOO=foo`)) }) - It("podman play kube test env value from configmap and --replace should reuse the configmap volume", func() { + It("test env value from configmap and --replace should reuse the configmap volume", func() { cmYamlPathname := filepath.Join(podmanTest.TempDir, "foo-cm.yaml") cm := getConfigMap(withConfigMapName("foo"), withConfigMapData("FOO", "foo")) err := generateKubeYaml("configmap", cm, cmYamlPathname) @@ -2631,22 +2646,22 @@ var _ = Describe("Podman play kube", func() { err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml, "--configmap", cmYamlPathname}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml, "--configmap", cmYamlPathname}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) // create pod again with --replace - kube = podmanTest.Podman([]string{"play", "kube", "--replace", kubeYaml, "--configmap", cmYamlPathname}) + kube = podmanTest.Podman([]string{"kube", "play", "--replace", kubeYaml, "--configmap", cmYamlPathname}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Env }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(`FOO=foo`)) }) - It("podman play kube test required env value from configmap with missing key", func() { + It("test required env value from configmap with missing key", func() { cmYamlPathname := filepath.Join(podmanTest.TempDir, "foo-cm.yaml") cm := getConfigMap(withConfigMapName("foo"), withConfigMapData("FOO", "foo")) err := generateKubeYaml("configmap", cm, cmYamlPathname) @@ -2656,22 +2671,22 @@ var _ = Describe("Podman play kube", func() { err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml, "--configmap", cmYamlPathname}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml, "--configmap", cmYamlPathname}) kube.WaitWithDefaultTimeout() Expect(kube).To(ExitWithError()) }) - It("podman play kube test required env value from missing configmap", func() { + It("test required env value from missing configmap", func() { pod := getPod(withCtr(getCtr(withEnv("FOO", "", "configmap", "missing_cm", "FOO", false)))) err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).To(ExitWithError()) }) - It("podman play kube test optional env value from configmap with missing key", func() { + It("test optional env value from configmap with missing key", func() { cmYamlPathname := filepath.Join(podmanTest.TempDir, "foo-cm.yaml") cm := getConfigMap(withConfigMapName("foo"), withConfigMapData("FOO", "foo")) err := generateKubeYaml("configmap", cm, cmYamlPathname) @@ -2681,32 +2696,32 @@ var _ = Describe("Podman play kube", func() { err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml, "--configmap", cmYamlPathname}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml, "--configmap", cmYamlPathname}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ range .Config.Env }}[{{ . }}]{{end}}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(Not(ContainSubstring(`[FOO=]`))) }) - It("podman play kube test optional env value from missing configmap", func() { + It("test optional env value from missing configmap", func() { pod := getPod(withCtr(getCtr(withEnv("FOO", "", "configmap", "missing_cm", "FOO", true)))) err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ range .Config.Env }}[{{ . }}]{{end}}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(Not(ContainSubstring(`[FOO=]`))) }) - It("podman play kube test get all key-value pairs from configmap as envs", func() { + It("test get all key-value pairs from configmap as envs", func() { cmYamlPathname := filepath.Join(podmanTest.TempDir, "foo-cm.yaml") cm := getConfigMap(withConfigMapName("foo"), withConfigMapData("FOO1", "foo1"), withConfigMapData("FOO2", "foo2")) err := generateKubeYaml("configmap", cm, cmYamlPathname) @@ -2716,199 +2731,199 @@ var _ = Describe("Podman play kube", func() { err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml, "--configmap", cmYamlPathname}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml, "--configmap", cmYamlPathname}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Env }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(`FOO1=foo1`)) Expect(inspect.OutputToString()).To(ContainSubstring(`FOO2=foo2`)) }) - It("podman play kube test get all key-value pairs from required configmap as envs", func() { + It("test get all key-value pairs from required configmap as envs", func() { pod := getPod(withCtr(getCtr(withEnvFrom("missing_cm", "configmap", false)))) err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).To(ExitWithError()) }) - It("podman play kube test get all key-value pairs from optional configmap as envs", func() { + It("test get all key-value pairs from optional configmap as envs", func() { pod := getPod(withCtr(getCtr(withEnvFrom("missing_cm", "configmap", true)))) err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) }) - It("podman play kube test env value from secret", func() { + It("test env value from secret", func() { createSecret(podmanTest, "foo", defaultSecret) pod := getPod(withCtr(getCtr(withEnv("FOO", "", "secret", "foo", "FOO", false)))) err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Env }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(`FOO=foo`)) }) - It("podman play kube test required env value from missing secret", func() { + It("test required env value from missing secret", func() { pod := getPod(withCtr(getCtr(withEnv("FOO", "", "secret", "foo", "FOO", false)))) err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).To(ExitWithError()) }) - It("podman play kube test required env value from secret with missing key", func() { + It("test required env value from secret with missing key", func() { createSecret(podmanTest, "foo", defaultSecret) pod := getPod(withCtr(getCtr(withEnv("FOO", "", "secret", "foo", "MISSING", false)))) err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).To(ExitWithError()) }) - It("podman play kube test optional env value from missing secret", func() { + It("test optional env value from missing secret", func() { pod := getPod(withCtr(getCtr(withEnv("FOO", "", "secret", "foo", "FOO", true)))) err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ range .Config.Env }}[{{ . }}]{{end}}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(Not(ContainSubstring(`[FOO=]`))) }) - It("podman play kube test optional env value from secret with missing key", func() { + It("test optional env value from secret with missing key", func() { createSecret(podmanTest, "foo", defaultSecret) pod := getPod(withCtr(getCtr(withEnv("FOO", "", "secret", "foo", "MISSING", true)))) err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ range .Config.Env }}[{{ . }}]{{end}}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(Not(ContainSubstring(`[FOO=]`))) }) - It("podman play kube test get all key-value pairs from secret as envs", func() { + It("test get all key-value pairs from secret as envs", func() { createSecret(podmanTest, "foo", defaultSecret) pod := getPod(withCtr(getCtr(withEnvFrom("foo", "secret", false)))) err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Env }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(`FOO=foo`)) Expect(inspect.OutputToString()).To(ContainSubstring(`BAR=bar`)) }) - It("podman play kube test get all key-value pairs from required secret as envs", func() { + It("test get all key-value pairs from required secret as envs", func() { pod := getPod(withCtr(getCtr(withEnvFrom("missing_secret", "secret", false)))) err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).To(ExitWithError()) }) - It("podman play kube test get all key-value pairs from optional secret as envs", func() { + It("test get all key-value pairs from optional secret as envs", func() { pod := getPod(withCtr(getCtr(withEnvFrom("missing_secret", "secret", true)))) err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) }) - It("podman play kube test duplicate container name", func() { + It("test duplicate container name", func() { p := getPod(withCtr(getCtr(withName("testctr"), withCmd([]string{"echo", "hello"}))), withCtr(getCtr(withName("testctr"), withCmd([]string{"echo", "world"})))) err := generateKubeYaml("pod", p, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).To(ExitWithError()) - p = getPod(withPodInitCtr(getCtr(withImage(ALPINE), withCmd([]string{"echo", "hello"}), withInitCtr(), withName("initctr"))), withCtr(getCtr(withImage(ALPINE), withName("initctr"), withCmd([]string{"top"})))) + p = getPod(withPodInitCtr(getCtr(withImage(CITEST_IMAGE), withCmd([]string{"echo", "hello"}), withInitCtr(), withName("initctr"))), withCtr(getCtr(withImage(CITEST_IMAGE), withName("initctr"), withCmd([]string{"top"})))) err = generateKubeYaml("pod", p, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube = podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube = podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).To(ExitWithError()) }) - It("podman play kube test hostname", func() { + It("test hostname", func() { pod := getPod() err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "{{ .Config.Hostname }}"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(Equal(defaultPodName)) }) - It("podman play kube test with customized hostname", func() { + It("test with customized hostname", func() { hostname := "myhostname" pod := getPod(withHostname(hostname)) err := generateKubeYaml("pod", getPod(withHostname(hostname)), kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "{{ .Config.Hostname }}"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(Equal(hostname)) hostnameInCtr := podmanTest.Podman([]string{"exec", getCtrNameInPod(pod), "hostname"}) hostnameInCtr.WaitWithDefaultTimeout() - Expect(hostnameInCtr).Should(Exit(0)) + Expect(hostnameInCtr).Should(ExitCleanly()) Expect(hostnameInCtr.OutputToString()).To(Equal(hostname)) }) - It("podman play kube test HostAliases", func() { + It("test HostAliases", func() { pod := getPod(withHostAliases("192.168.1.2", []string{ "test1.podman.io", "test2.podman.io", @@ -2921,18 +2936,18 @@ var _ = Describe("Podman play kube", func() { err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", pod.Name, "--format", "{{ .InfraConfig.HostAdd}}"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()). To(Equal("[test1.podman.io:192.168.1.2 test2.podman.io:192.168.1.2 test3.podman.io:192.168.1.3 test4.podman.io:192.168.1.3]")) }) - It("podman play kube cap add", func() { + It("cap add", func() { capAdd := "CAP_SYS_ADMIN" ctr := getCtr(withCapAdd([]string{capAdd}), withCmd([]string{"cat", "/proc/self/status"}), withArg(nil)) @@ -2940,17 +2955,17 @@ var _ = Describe("Podman play kube", func() { err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod)}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(capAdd)) }) - It("podman play kube cap drop", func() { + It("cap drop", func() { capDrop := "CAP_CHOWN" ctr := getCtr(withCapDrop([]string{capDrop})) @@ -2958,34 +2973,34 @@ var _ = Describe("Podman play kube", func() { err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod)}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(capDrop)) }) - It("podman play kube no security context", func() { - // expect play kube to not fail if no security context is specified + It("no security context", func() { + // expect kube play to not fail if no security context is specified pod := getPod(withCtr(getCtr(withSecurityContext(false)))) err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod)}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) }) - It("podman play kube seccomp container level", func() { + It("seccomp container level", func() { SkipIfRemote("podman-remote does not support --seccomp-profile-root flag") - // expect play kube is expected to set a seccomp label if it's applied as an annotation + // expect kube play is expected to set a seccomp label if it's applied as an annotation jsonFile, err := podmanTest.CreateSeccompJSON(seccompPwdEPERM) if err != nil { GinkgoWriter.Println(err) @@ -2999,10 +3014,10 @@ var _ = Describe("Podman play kube", func() { err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - // CreateSeccompJSON will put the profile into podmanTest.TempDir. Use --seccomp-profile-root to tell play kube where to look - kube := podmanTest.Podman([]string{"play", "kube", "--seccomp-profile-root", podmanTest.TempDir, kubeYaml}) + // CreateSeccompJSON will put the profile into podmanTest.TempDir. Use --seccomp-profile-root to tell kube play where to look + kube := podmanTest.Podman([]string{"kube", "play", "--seccomp-profile-root", podmanTest.TempDir, kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) ctrName := getCtrNameInPod(pod) wait := podmanTest.Podman([]string{"wait", ctrName}) @@ -3015,9 +3030,9 @@ var _ = Describe("Podman play kube", func() { Expect(logs.ErrorToString()).To(ContainSubstring("getcwd: Operation not permitted")) }) - It("podman play kube seccomp pod level", func() { + It("seccomp pod level", func() { SkipIfRemote("podman-remote does not support --seccomp-profile-root flag") - // expect play kube is expected to set a seccomp label if it's applied as an annotation + // expect kube play is expected to set a seccomp label if it's applied as an annotation jsonFile, err := podmanTest.CreateSeccompJSON(seccompPwdEPERM) if err != nil { GinkgoWriter.Println(err) @@ -3031,15 +3046,15 @@ var _ = Describe("Podman play kube", func() { err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - // CreateSeccompJSON will put the profile into podmanTest.TempDir. Use --seccomp-profile-root to tell play kube where to look - kube := podmanTest.Podman([]string{"play", "kube", "--seccomp-profile-root", podmanTest.TempDir, kubeYaml}) + // CreateSeccompJSON will put the profile into podmanTest.TempDir. Use --seccomp-profile-root to tell kube play where to look + kube := podmanTest.Podman([]string{"kube", "play", "--seccomp-profile-root", podmanTest.TempDir, kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) podName := getCtrNameInPod(pod) wait := podmanTest.Podman([]string{"wait", podName}) wait.WaitWithDefaultTimeout() - Expect(wait).Should(Exit(0)) + Expect(wait).Should(ExitCleanly()) logs := podmanTest.Podman([]string{"logs", podName}) logs.WaitWithDefaultTimeout() @@ -3047,39 +3062,39 @@ var _ = Describe("Podman play kube", func() { Expect(logs.ErrorToString()).To(ContainSubstring("Operation not permitted")) }) - It("podman play kube with pull policy of never should be 125", func() { + It("with pull policy of never should be 125", func() { ctr := getCtr(withPullPolicy("never"), withImage(BB_GLIBC)) err := generateKubeYaml("pod", getPod(withCtr(ctr)), kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).Should(Exit(125)) Expect(kube.ErrorToString()).To(ContainSubstring(BB_GLIBC + ": image not known")) }) - It("podman play kube with pull policy of missing", func() { - ctr := getCtr(withPullPolicy("Missing"), withImage(BB)) + It("with pull policy of missing", func() { + ctr := getCtr(withPullPolicy("Missing"), withImage(CITEST_IMAGE)) err := generateKubeYaml("pod", getPod(withCtr(ctr)), kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) }) - It("podman play kube with pull always", func() { + It("with pull always", func() { oldBB := "quay.io/libpod/busybox:1.30.1" pull := podmanTest.Podman([]string{"pull", oldBB}) pull.WaitWithDefaultTimeout() tag := podmanTest.Podman([]string{"tag", oldBB, BB}) tag.WaitWithDefaultTimeout() - Expect(tag).Should(Exit(0)) + Expect(tag).Should(ExitCleanly()) rmi := podmanTest.Podman([]string{"rmi", oldBB}) rmi.WaitWithDefaultTimeout() - Expect(rmi).Should(Exit(0)) + Expect(rmi).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", BB}) inspect.WaitWithDefaultTimeout() @@ -3089,8 +3104,9 @@ var _ = Describe("Podman play kube", func() { err := generateKubeYaml("pod", getPod(withCtr(ctr)), kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() + // Cannot ExitCleanly() because pull output goes to stderr Expect(kube).Should(Exit(0)) inspect = podmanTest.Podman([]string{"inspect", BB}) @@ -3099,29 +3115,31 @@ var _ = Describe("Podman play kube", func() { Expect(oldBBinspect[0].Digest).To(Not(Equal(newBBinspect[0].Digest))) }) - It("podman play kube with latest image should always pull", func() { + It("with latest image should always pull", func() { oldBB := "quay.io/libpod/busybox:1.30.1" pull := podmanTest.Podman([]string{"pull", oldBB}) pull.WaitWithDefaultTimeout() + Expect(pull).Should(Exit(0)) tag := podmanTest.Podman([]string{"tag", oldBB, BB}) tag.WaitWithDefaultTimeout() - Expect(tag).Should(Exit(0)) + Expect(tag).Should(ExitCleanly()) rmi := podmanTest.Podman([]string{"rmi", oldBB}) rmi.WaitWithDefaultTimeout() - Expect(rmi).Should(Exit(0)) + Expect(rmi).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", BB}) inspect.WaitWithDefaultTimeout() oldBBinspect := inspect.InspectImageJSON() - ctr := getCtr(withImage(BB)) + ctr := getCtr(withImage(BB), withPullPolicy("")) err := generateKubeYaml("pod", getPod(withCtr(ctr)), kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() + // Cannot ExitCleanly() because pull output goes to stderr Expect(kube).Should(Exit(0)) inspect = podmanTest.Podman([]string{"inspect", BB}) @@ -3130,7 +3148,7 @@ var _ = Describe("Podman play kube", func() { Expect(oldBBinspect[0].Digest).To(Not(Equal(newBBinspect[0].Digest))) }) - It("podman play kube with image data", func() { + It("with image data", func() { testyaml := ` apiVersion: v1 kind: Pod @@ -3141,27 +3159,27 @@ spec: - image: demo name: demo_kube ` - pull := podmanTest.Podman([]string{"create", "--workdir", "/etc", "--name", "newBB", "--label", "key1=value1", "alpine"}) + pull := podmanTest.Podman([]string{"create", "--workdir", "/etc", "--name", "newBB", "--label", "key1=value1", CITEST_IMAGE}) pull.WaitWithDefaultTimeout() - Expect(pull).Should(Exit(0)) + Expect(pull).Should(ExitCleanly()) - c := podmanTest.Podman([]string{"commit", "-c", "STOPSIGNAL=51", "newBB", "demo"}) + c := podmanTest.Podman([]string{"commit", "-q", "-c", "STOPSIGNAL=51", "newBB", "demo"}) c.WaitWithDefaultTimeout() - Expect(c).Should(Exit(0)) + Expect(c).Should(ExitCleanly()) conffile := filepath.Join(podmanTest.TempDir, "kube.yaml") err := os.WriteFile(conffile, []byte(testyaml), 0755) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", conffile}) + kube := podmanTest.Podman([]string{"kube", "play", conffile}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", "demo_pod-demo_kube"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) ctr := inspect.InspectContainerToJSON() Expect(ctr[0].Config.WorkingDir).To(ContainSubstring("/etc")) @@ -3170,61 +3188,66 @@ spec: Expect(ctr[0].Config).To(HaveField("StopSignal", uint(51))) }) - It("podman play kube daemonset sanity", func() { + It("daemonset sanity", func() { daemonset := getDaemonSet() err := generateKubeYaml("daemonset", daemonset, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) podName := getPodNameInDaemonSet(daemonset) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(&podName), "--format", "'{{ .Config.Entrypoint }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) // yaml's command should override the image's Entrypoint Expect(inspect.OutputToString()).To(ContainSubstring(strings.Join(defaultCtrCmd, " "))) }) // Deployment related tests - It("podman play kube deployment 1 replica test correct command", func() { + It("deployment 1 replica test correct command", func() { deployment := getDeployment() err := generateKubeYaml("deployment", deployment, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) podName := getPodNameInDeployment(deployment) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(&podName), "--format", "'{{ .Config.Entrypoint }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) // yaml's command should override the image's Entrypoint Expect(inspect.OutputToString()).To(ContainSubstring(strings.Join(defaultCtrCmd, " "))) }) - It("podman play kube deployment more than 1 replica test correct command", func() { + It("deployment more than 1 replica test correct command", func() { var numReplicas int32 = 5 deployment := getDeployment(withReplicas(numReplicas)) err := generateKubeYaml("deployment", deployment, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).Should(Exit(0)) + if IsRemote() { + Expect(kube.ErrorToString()).To(BeEmpty()) + } else { + Expect(kube.ErrorToString()).To(ContainSubstring("Limiting replica count to 1, more than one replica is not supported by Podman")) + } podName := getPodNameInDeployment(deployment) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(&podName), "--format", "'{{ .Config.Entrypoint }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(strings.Join(defaultCtrCmd, " "))) }) - It("podman play kube --ip and --mac-address", func() { + It("--ip and --mac-address", func() { var i, numReplicas int32 numReplicas = 3 deployment := getDeployment(withReplicas(numReplicas)) @@ -3235,10 +3258,10 @@ spec: session := podmanTest.Podman([]string{"network", "create", "--subnet", "10.25.31.0/24", net}) session.WaitWithDefaultTimeout() defer podmanTest.removeNetwork(net) - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) ips := []string{"10.25.31.5", "10.25.31.10", "10.25.31.15"} - playArgs := []string{"play", "kube", "--network", net} + playArgs := []string{"kube", "play", "--network", net} for _, ip := range ips { playArgs = append(playArgs, "--ip", ip) } @@ -3250,23 +3273,28 @@ spec: kube := podmanTest.Podman(append(playArgs, kubeYaml)) kube.WaitWithDefaultTimeout() Expect(kube).Should(Exit(0)) + if IsRemote() { + Expect(kube.ErrorToString()).To(BeEmpty()) + } else { + Expect(kube.ErrorToString()).To(ContainSubstring("Limiting replica count to 1, more than one replica is not supported by Podman")) + } podName := getPodNameInDeployment(deployment) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(&podName), "--format", "{{ .NetworkSettings.Networks." + net + ".IPAddress }}"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(Equal(ips[i])) inspect = podmanTest.Podman([]string{"inspect", getCtrNameInPod(&podName), "--format", "{{ .NetworkSettings.Networks." + net + ".MacAddress }}"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(Equal(macs[i])) }) - It("podman play kube with multiple networks", func() { - ctr := getCtr(withImage(ALPINE)) + It("with multiple networks", func() { + ctr := getCtr(withImage(CITEST_IMAGE)) pod := getPod(withCtr(ctr)) err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) @@ -3277,62 +3305,62 @@ spec: net := podmanTest.Podman([]string{"network", "create", "--subnet", "10.0.11.0/24", net1}) net.WaitWithDefaultTimeout() defer podmanTest.removeNetwork(net1) - Expect(net).Should(Exit(0)) + Expect(net).Should(ExitCleanly()) net = podmanTest.Podman([]string{"network", "create", "--subnet", "10.0.12.0/24", net2}) net.WaitWithDefaultTimeout() defer podmanTest.removeNetwork(net2) - Expect(net).Should(Exit(0)) + Expect(net).Should(ExitCleanly()) ip1 := "10.0.11.5" ip2 := "10.0.12.10" - kube := podmanTest.Podman([]string{"play", "kube", "--network", net1 + ":ip=" + ip1, "--network", net2 + ":ip=" + ip2, kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", "--network", net1 + ":ip=" + ip1, "--network", net2 + ":ip=" + ip2, kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"exec", getCtrNameInPod(pod), "ip", "addr"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(ip1)) Expect(inspect.OutputToString()).To(ContainSubstring(ip2)) Expect(inspect.OutputToString()).To(ContainSubstring("eth0")) Expect(inspect.OutputToString()).To(ContainSubstring("eth1")) }) - It("podman play kube test with network portbindings", func() { + It("test with network portbindings", func() { ip := "127.0.0.100" port := "8087" - ctr := getCtr(withHostIP(ip, port), withImage(BB)) + ctr := getCtr(withHostIP(ip, port), withImage(CITEST_IMAGE)) pod := getPod(withCtr(ctr)) err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"port", getCtrNameInPod(pod)}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(Equal("8087/tcp -> 127.0.0.100:8087")) }) - It("podman play kube test with nonexistent empty HostPath type volume", func() { + It("test with nonexistent empty HostPath type volume", func() { hostPathLocation := filepath.Join(tempdir, "file") pod := getPod(withVolume(getHostPathVolume(`""`, hostPathLocation))) err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).To(ExitWithError()) Expect(kube.ErrorToString()).To(ContainSubstring(defaultVolName)) }) - It("podman play kube test with empty HostPath type volume", func() { + It("test with empty HostPath type volume", func() { hostPathLocation := filepath.Join(tempdir, "file") f, err := os.Create(hostPathLocation) Expect(err).ToNot(HaveOccurred()) @@ -3342,24 +3370,24 @@ spec: err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) }) - It("podman play kube test with nonexistent File HostPath type volume", func() { + It("test with nonexistent File HostPath type volume", func() { hostPathLocation := filepath.Join(tempdir, "file") pod := getPod(withVolume(getHostPathVolume("File", hostPathLocation))) err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).To(ExitWithError()) }) - It("podman play kube test with File HostPath type volume", func() { + It("test with File HostPath type volume", func() { hostPathLocation := filepath.Join(tempdir, "file") f, err := os.Create(hostPathLocation) Expect(err).ToNot(HaveOccurred()) @@ -3369,37 +3397,37 @@ spec: err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) }) - It("podman play kube test with FileOrCreate HostPath type volume", func() { + It("test with FileOrCreate HostPath type volume", func() { hostPathLocation := filepath.Join(tempdir, "file") pod := getPod(withVolume(getHostPathVolume("FileOrCreate", hostPathLocation))) err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) // the file should have been created _, err = os.Stat(hostPathLocation) Expect(err).ToNot(HaveOccurred()) }) - It("podman play kube test with DirectoryOrCreate HostPath type volume", func() { + It("test with DirectoryOrCreate HostPath type volume", func() { hostPathLocation := filepath.Join(tempdir, "file") pod := getPod(withVolume(getHostPathVolume("DirectoryOrCreate", hostPathLocation))) err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) // the file should have been created st, err := os.Stat(hostPathLocation) @@ -3407,16 +3435,16 @@ spec: Expect(st.Mode().IsDir()).To(BeTrue(), "hostPathLocation is a directory") }) - It("podman play kube test with DirectoryOrCreate HostPath type volume and non-existent directory path", func() { + It("test with DirectoryOrCreate HostPath type volume and non-existent directory path", func() { hostPathLocation := filepath.Join(filepath.Join(tempdir, "dir1"), "dir2") pod := getPod(withVolume(getHostPathVolume("DirectoryOrCreate", hostPathLocation))) err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) // the full path should have been created st, err := os.Stat(hostPathLocation) @@ -3424,7 +3452,7 @@ spec: Expect(st.Mode().IsDir()).To(BeTrue(), "hostPathLocation is a directory") }) - It("podman play kube test with DirectoryOrCreate HostPath type volume and existent directory path", func() { + It("test with DirectoryOrCreate HostPath type volume and existent directory path", func() { hostPathLocation := filepath.Join(filepath.Join(tempdir, "dir1"), "dir2") Expect(os.MkdirAll(hostPathLocation, os.ModePerm)).To(Succeed()) @@ -3432,12 +3460,12 @@ spec: err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) }) - It("podman play kube test with Socket HostPath type volume should fail if not socket", func() { + It("test with Socket HostPath type volume should fail if not socket", func() { hostPathLocation := filepath.Join(tempdir, "file") f, err := os.Create(hostPathLocation) Expect(err).ToNot(HaveOccurred()) @@ -3447,35 +3475,35 @@ spec: err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).To(ExitWithError()) }) - It("podman play kube test with read-only HostPath volume", func() { + It("test with read-only HostPath volume", func() { hostPathLocation := filepath.Join(tempdir, "file") f, err := os.Create(hostPathLocation) Expect(err).ToNot(HaveOccurred()) f.Close() - ctr := getCtr(withVolumeMount(hostPathLocation, "", true), withImage(BB)) + ctr := getCtr(withVolumeMount(hostPathLocation, "", true), withImage(CITEST_IMAGE)) pod := getPod(withVolume(getHostPathVolume("File", hostPathLocation)), withCtr(ctr)) err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{.HostConfig.Binds}}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) correct := fmt.Sprintf("%s:%s:%s", hostPathLocation, hostPathLocation, "ro") Expect(inspect.OutputToString()).To(ContainSubstring(correct)) }) - It("podman play kube test duplicate volume destination between host path and image volumes", func() { + It("test duplicate volume destination between host path and image volumes", func() { // Create host test directory and file testdir := "testdir" testfile := "testfile" @@ -3492,34 +3520,34 @@ spec: if selinux.GetEnabled() { label := SystemExec("chcon", []string{"-t", "container_file_t", hostPathDirFile}) - Expect(label).Should(Exit(0)) + Expect(label).Should(ExitCleanly()) } // Create container image with named volume containerfile := fmt.Sprintf(` FROM %s -VOLUME %s`, ALPINE, hostPathDir+"/") +VOLUME %s`, CITEST_IMAGE, hostPathDir+"/") image := "podman-kube-test:podman" podmanTest.BuildImage(containerfile, image, "false") - // Create and play kube pod + // Create and kube play pod ctr := getCtr(withVolumeMount(hostPathDir+"/", "", false), withImage(image)) pod := getPod(withCtr(ctr), withVolume(getHostPathVolume("Directory", hostPathDir+"/"))) err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) result := podmanTest.Podman([]string{"exec", getCtrNameInPod(pod), "ls", hostPathDir + "/" + testfile}) result.WaitWithDefaultTimeout() - Expect(result).Should(Exit(0)) + Expect(result).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod)}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) // If two volumes are specified and share the same destination, // only one will be mounted. Host path volumes take precedence. @@ -3529,33 +3557,33 @@ VOLUME %s`, ALPINE, hostPathDir+"/") }) - It("podman play kube test with PersistentVolumeClaim volume", func() { + It("test with PersistentVolumeClaim volume", func() { volumeName := "namedVolume" - ctr := getCtr(withVolumeMount("/test", "", false), withImage(BB)) + ctr := getCtr(withVolumeMount("/test", "", false), withImage(CITEST_IMAGE)) pod := getPod(withVolume(getPersistentVolumeClaimVolume(volumeName)), withCtr(ctr)) err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "{{ (index .Mounts 0).Type }}:{{ (index .Mounts 0).Name }}"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) correct := fmt.Sprintf("volume:%s", volumeName) Expect(inspect.OutputToString()).To(Equal(correct)) }) - It("podman play kube ConfigMap volume with no items", func() { + It("ConfigMap volume with no items", func() { volumeName := "cmVol" cm := getConfigMap(withConfigMapName(volumeName), withConfigMapData("FOO", "foobar")) cmYaml, err := getKubeYaml("configmap", cm) Expect(err).ToNot(HaveOccurred()) - ctr := getCtr(withVolumeMount("/test", "", false), withImage(BB)) + ctr := getCtr(withVolumeMount("/test", "", false), withImage(CITEST_IMAGE)) pod := getPod(withVolume(getConfigMapVolume(volumeName, []map[string]string{}, false)), withCtr(ctr)) podYaml, err := getKubeYaml("pod", pod) Expect(err).ToNot(HaveOccurred()) @@ -3563,17 +3591,17 @@ VOLUME %s`, ALPINE, hostPathDir+"/") err = generateMultiDocKubeYaml(yamls, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) cmData := podmanTest.Podman([]string{"exec", getCtrNameInPod(pod), "cat", "/test/FOO"}) cmData.WaitWithDefaultTimeout() - Expect(cmData).Should(Exit(0)) + Expect(cmData).Should(ExitCleanly()) Expect(cmData.OutputToString()).To(Equal("foobar")) }) - It("podman play kube ConfigMap volume with items", func() { + It("ConfigMap volume with items", func() { volumeName := "cmVol" cm := getConfigMap(withConfigMapName(volumeName), withConfigMapData("FOO", "foobar")) cmYaml, err := getKubeYaml("configmap", cm) @@ -3583,7 +3611,7 @@ VOLUME %s`, ALPINE, hostPathDir+"/") "path": "BAR", }} - ctr := getCtr(withVolumeMount("/test", "", false), withImage(BB)) + ctr := getCtr(withVolumeMount("/test", "", false), withImage(CITEST_IMAGE)) pod := getPod(withVolume(getConfigMapVolume(volumeName, volumeContents, false)), withCtr(ctr)) podYaml, err := getKubeYaml("pod", pod) Expect(err).ToNot(HaveOccurred()) @@ -3591,71 +3619,71 @@ VOLUME %s`, ALPINE, hostPathDir+"/") err = generateMultiDocKubeYaml(yamls, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) cmData := podmanTest.Podman([]string{"exec", getCtrNameInPod(pod), "cat", "/test/BAR"}) cmData.WaitWithDefaultTimeout() - Expect(cmData).Should(Exit(0)) + Expect(cmData).Should(ExitCleanly()) Expect(cmData.OutputToString()).To(Equal("foobar")) cmData = podmanTest.Podman([]string{"exec", getCtrNameInPod(pod), "cat", "/test/FOO"}) cmData.WaitWithDefaultTimeout() - Expect(cmData).Should(Not(Exit(0))) + Expect(cmData).Should(Not(ExitCleanly())) }) - It("podman play kube with a missing optional ConfigMap volume", func() { + It("with a missing optional ConfigMap volume", func() { volumeName := "cmVol" - ctr := getCtr(withVolumeMount("/test", "", false), withImage(BB)) + ctr := getCtr(withVolumeMount("/test", "", false), withImage(CITEST_IMAGE)) pod := getPod(withVolume(getConfigMapVolume(volumeName, []map[string]string{}, true)), withCtr(ctr)) err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) }) - It("podman play kube with emptyDir volume", func() { + It("with emptyDir volume", func() { podName := "test-pod" ctrName1 := "vol-test-ctr" ctrName2 := "vol-test-ctr-2" - ctr1 := getCtr(withVolumeMount("/test-emptydir", "", false), withImage(BB), withName(ctrName1)) - ctr2 := getCtr(withVolumeMount("/test-emptydir-2", "", false), withImage(BB), withName(ctrName2)) + ctr1 := getCtr(withVolumeMount("/test-emptydir", "", false), withImage(CITEST_IMAGE), withName(ctrName1)) + ctr2 := getCtr(withVolumeMount("/test-emptydir-2", "", false), withImage(CITEST_IMAGE), withName(ctrName2)) pod := getPod(withPodName(podName), withVolume(getEmptyDirVolume()), withCtr(ctr1), withCtr(ctr2)) err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) emptyDirCheck1 := podmanTest.Podman([]string{"exec", podName + "-" + ctrName1, "ls", "/test-emptydir"}) emptyDirCheck1.WaitWithDefaultTimeout() - Expect(emptyDirCheck1).Should(Exit(0)) + Expect(emptyDirCheck1).Should(ExitCleanly()) emptyDirCheck2 := podmanTest.Podman([]string{"exec", podName + "-" + ctrName2, "ls", "/test-emptydir-2"}) emptyDirCheck2.WaitWithDefaultTimeout() - Expect(emptyDirCheck2).Should(Exit(0)) + Expect(emptyDirCheck2).Should(ExitCleanly()) volList1 := podmanTest.Podman([]string{"volume", "ls", "-q"}) volList1.WaitWithDefaultTimeout() - Expect(volList1).Should(Exit(0)) + Expect(volList1).Should(ExitCleanly()) Expect(volList1.OutputToString()).To(Equal(defaultVolName)) remove := podmanTest.Podman([]string{"pod", "rm", "-f", podName}) remove.WaitWithDefaultTimeout() - Expect(remove).Should(Exit(0)) + Expect(remove).Should(ExitCleanly()) volList2 := podmanTest.Podman([]string{"volume", "ls", "-q"}) volList2.WaitWithDefaultTimeout() - Expect(volList2).Should(Exit(0)) + Expect(volList2).Should(ExitCleanly()) Expect(volList2.OutputToString()).To(Equal("")) }) - It("podman play kube applies labels to pods", func() { + It("applies labels to pods", func() { var numReplicas int32 = 5 expectedLabelKey := "key1" expectedLabelValue := "value1" @@ -3666,19 +3694,24 @@ VOLUME %s`, ALPINE, hostPathDir+"/") err := generateKubeYaml("deployment", deployment, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).Should(Exit(0)) + if IsRemote() { + Expect(kube.ErrorToString()).To(BeEmpty()) + } else { + Expect(kube.ErrorToString()).To(ContainSubstring("Limiting replica count to 1, more than one replica is not supported by Podman")) + } correctLabels := expectedLabelKey + ":" + expectedLabelValue pod := getPodNameInDeployment(deployment) inspect := podmanTest.Podman([]string{"pod", "inspect", pod.Name, "--format", "'{{ .Labels }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(correctLabels)) }) - It("podman play kube allows setting resource limits", func() { + It("allows setting resource limits", func() { SkipIfContainerized("Resource limits require a running systemd") SkipIfRootless("CPU limits require root") podmanTest.CgroupManager = "systemd" @@ -3704,9 +3737,14 @@ VOLUME %s`, ALPINE, hostPathDir+"/") err := generateKubeYaml("deployment", deployment, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).Should(Exit(0)) + if IsRemote() { + Expect(kube.ErrorToString()).To(BeEmpty()) + } else { + Expect(kube.ErrorToString()).To(ContainSubstring("Limiting replica count to 1, more than one replica is not supported by Podman")) + } pod := getPodNameInDeployment(deployment) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(&pod), "--format", ` @@ -3715,14 +3753,14 @@ CpuQuota: {{ .HostConfig.CpuQuota }} Memory: {{ .HostConfig.Memory }} MemoryReservation: {{ .HostConfig.MemoryReservation }}`}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(fmt.Sprintf("%s: %d", "CpuQuota", expectedCPUQuota))) Expect(inspect.OutputToString()).To(ContainSubstring("MemoryReservation: " + expectedMemoryRequest)) Expect(inspect.OutputToString()).To(ContainSubstring("Memory: " + expectedMemoryLimit)) }) - It("podman play kube allows setting resource limits with --cpus 1", func() { + It("allows setting resource limits with --cpus 1", func() { SkipIfContainerized("Resource limits require a running systemd") SkipIfRootless("CPU limits require root") podmanTest.CgroupManager = "systemd" @@ -3738,15 +3776,15 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`}) err := generateKubeYaml("deployment", deployment, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) pod := getPodNameInDeployment(deployment) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(&pod), "--format", `{{ .HostConfig.CpuPeriod }}:{{ .HostConfig.CpuQuota }}`}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) parts := strings.Split(strings.Trim(inspect.OutputToString(), "\n"), ":") Expect(parts).To(HaveLen(2)) @@ -3755,7 +3793,7 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`}) }) - It("podman play kube reports invalid image name", func() { + It("reports invalid image name", func() { invalidImageName := "./myimage" pod := getPod( @@ -3768,90 +3806,90 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`}) err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).Should(Exit(125)) Expect(kube.ErrorToString()).To(ContainSubstring("invalid reference format")) }) - It("podman play kube applies log driver to containers", func() { + It("applies log driver to containers", func() { SkipIfInContainer("journald inside a container doesn't work") pod := getPod() err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", "--log-opt=max-size=10k", "--log-driver", "journald", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", "--log-opt=max-size=10k", "--log-driver", "journald", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) cid := getCtrNameInPod(pod) inspect := podmanTest.Podman([]string{"inspect", cid, "--format", "'{{ .HostConfig.LogConfig.Type }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring("journald")) inspect = podmanTest.Podman([]string{"container", "inspect", "--format", "{{.HostConfig.LogConfig.Size}}", cid}) inspect.WaitWithDefaultTimeout() - Expect(inspect).To(Exit(0)) + Expect(inspect).To(ExitCleanly()) Expect(inspect.OutputToString()).To(Equal("10kB")) }) - It("podman play kube test only creating the containers", func() { + It("test only creating the containers", func() { pod := getPod() err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", "--start=false", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", "--start=false", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "{{ .State.Running }}"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(Equal("false")) }) - It("podman play kube test with HostNetwork", func() { + It("test with HostNetwork", func() { pod := getPod(withHostNetwork(), withCtr(getCtr(withCmd([]string{"readlink", "/proc/self/ns/net"}), withArg(nil)))) err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", pod.Name, "--format", "{{ .InfraConfig.HostNetwork }}"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(Equal("true")) ns := SystemExec("readlink", []string{"/proc/self/ns/net"}) ns.WaitWithDefaultTimeout() - Expect(ns).Should(Exit(0)) + Expect(ns).Should(ExitCleanly()) netns := ns.OutputToString() Expect(netns).ToNot(BeEmpty()) logs := podmanTest.Podman([]string{"logs", getCtrNameInPod(pod)}) logs.WaitWithDefaultTimeout() - Expect(logs).Should(Exit(0)) + Expect(logs).Should(ExitCleanly()) Expect(logs.OutputToString()).To(Equal(netns)) }) - It("podman play kube test with kube default network", func() { + It("test with kube default network", func() { pod := getPod() err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", pod.Name, "--format", "{{ .InfraConfig.Networks }}"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(Equal("[podman-default-kube-network]")) }) - It("podman play kube persistentVolumeClaim", func() { + It("persistentVolumeClaim", func() { volName := "myvol" volDevice := define.TypeTmpfs volType := define.TypeTmpfs @@ -3864,9 +3902,9 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`}) err = generateKubeYaml("persistentVolumeClaim", pvc, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", volName, "--format", ` Name: {{ .Name }} @@ -3874,14 +3912,14 @@ Device: {{ .Options.device }} Type: {{ .Options.type }} o: {{ .Options.o }}`}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring("Name: " + volName)) Expect(inspect.OutputToString()).To(ContainSubstring("Device: " + volDevice)) Expect(inspect.OutputToString()).To(ContainSubstring("Type: " + volType)) Expect(inspect.OutputToString()).To(ContainSubstring("o: " + volOpts)) }) - It("podman play kube persistentVolumeClaim with source", func() { + It("persistentVolumeClaim with source", func() { fileName := "data" expectedFileContent := "Test" tarFilePath := filepath.Join(os.TempDir(), "podmanVolumeSource.tgz") @@ -3895,14 +3933,14 @@ o: {{ .Options.o }}`}) err = generateKubeYaml("persistentVolumeClaim", pvc, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() if IsRemote() { Expect(kube).Should(Exit(125)) Expect(kube.ErrorToString()).To(ContainSubstring("importing volumes is not supported for remote requests")) return } - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", volName, "--format", ` { @@ -3910,7 +3948,7 @@ o: {{ .Options.o }}`}) "Mountpoint": "{{ .Mountpoint }}" }`}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) mp := make(map[string]string) err = json.Unmarshal([]byte(inspect.OutputToString()), &mp) Expect(err).ToNot(HaveOccurred()) @@ -3922,7 +3960,7 @@ o: {{ .Options.o }}`}) }) // Multi doc related tests - It("podman play kube multi doc yaml with persistentVolumeClaim, service and deployment", func() { + It("multi doc yaml with persistentVolumeClaim, service and deployment", func() { yamlDocs := []string{} serviceTemplate := `apiVersion: v1 @@ -3968,29 +4006,29 @@ spec: err = generateMultiDocKubeYaml(yamlDocs, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspectVolume := podmanTest.Podman([]string{"inspect", volName, "--format", "'{{ .Name }}'"}) inspectVolume.WaitWithDefaultTimeout() - Expect(inspectVolume).Should(Exit(0)) + Expect(inspectVolume).Should(ExitCleanly()) Expect(inspectVolume.OutputToString()).To(ContainSubstring(volName)) inspectPod := podmanTest.Podman([]string{"inspect", podName + "-pod", "--format", "'{{ .State }}'"}) inspectPod.WaitWithDefaultTimeout() - Expect(inspectPod).Should(Exit(0)) + Expect(inspectPod).Should(ExitCleanly()) Expect(inspectPod.OutputToString()).To(ContainSubstring(`Running`)) inspectMounts := podmanTest.Podman([]string{"inspect", podName + "-pod-" + ctrName, "--format", "{{ (index .Mounts 0).Type }}:{{ (index .Mounts 0).Name }}"}) inspectMounts.WaitWithDefaultTimeout() - Expect(inspectMounts).Should(Exit(0)) + Expect(inspectMounts).Should(ExitCleanly()) correct := fmt.Sprintf("volume:%s", volName) Expect(inspectMounts.OutputToString()).To(Equal(correct)) }) - It("podman play kube multi doc yaml with multiple services, pods and deployments", func() { + It("multi doc yaml with multiple services, pods and deployments", func() { yamlDocs := []string{} podNames := []string{} @@ -4040,19 +4078,19 @@ spec: err = generateMultiDocKubeYaml(yamlDocs, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) for _, n := range podNames { inspect := podmanTest.Podman([]string{"inspect", n, "--format", "'{{ .State }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(`Running`)) } }) - It("podman play kube invalid multi doc yaml", func() { + It("invalid multi doc yaml", func() { yamlDocs := []string{} serviceTemplate := `apiVersion: v1 @@ -4082,12 +4120,12 @@ invalid kube kind err = generateMultiDocKubeYaml(yamlDocs, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).To(ExitWithError()) }) - It("podman play kube with auto update annotations for all containers", func() { + It("with auto update annotations for all containers", func() { ctr01Name := "ctr01" ctr02Name := "infra" podName := "foo" @@ -4109,21 +4147,21 @@ invalid kube kind err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) for _, ctr := range []string{podName + "-" + ctr01Name, podName + "-" + ctr02Name} { inspect := podmanTest.Podman([]string{"inspect", ctr, "--format", "'{{.Config.Labels}}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(autoUpdateRegistry + ":" + autoUpdateRegistryValue)) Expect(inspect.OutputToString()).To(ContainSubstring(autoUpdateAuthfile + ":" + autoUpdateAuthfileValue)) } }) - It("podman play kube with auto update annotations for first container only", func() { + It("with auto update annotations for first container only", func() { ctr01Name := "ctr01" ctr02Name := "ctr02" autoUpdateRegistry := "io.containers.autoupdate" @@ -4145,91 +4183,91 @@ invalid kube kind err = generateKubeYaml("deployment", deployment, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) podName := getPodNameInDeployment(deployment).Name inspect := podmanTest.Podman([]string{"inspect", podName + "-" + ctr01Name, "--format", "'{{.Config.Labels}}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(autoUpdateRegistry + ":" + autoUpdateRegistryValue)) inspect = podmanTest.Podman([]string{"inspect", podName + "-" + ctr02Name, "--format", "'{{.Config.Labels}}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).NotTo(ContainSubstring(autoUpdateRegistry + ":" + autoUpdateRegistryValue)) }) - It("podman play kube teardown", func() { + It("teardown", func() { pod := getPod() err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) ls := podmanTest.Podman([]string{"pod", "ps", "--format", "'{{.ID}}'"}) ls.WaitWithDefaultTimeout() - Expect(ls).Should(Exit(0)) + Expect(ls).Should(ExitCleanly()) Expect(ls.OutputToStringArray()).To(HaveLen(1)) - teardown := podmanTest.Podman([]string{"play", "kube", "--down", kubeYaml}) + teardown := podmanTest.Podman([]string{"kube", "play", "--down", kubeYaml}) teardown.WaitWithDefaultTimeout() - Expect(teardown).Should(Exit(0)) + Expect(teardown).Should(ExitCleanly()) // Removing a 2nd time to make sure no "no such error" is returned (see #19711) - teardown = podmanTest.Podman([]string{"play", "kube", "--down", kubeYaml}) + teardown = podmanTest.Podman([]string{"kube", "play", "--down", kubeYaml}) teardown.WaitWithDefaultTimeout() - Expect(teardown).Should(Exit(0)) + Expect(teardown).Should(ExitCleanly()) checkls := podmanTest.Podman([]string{"pod", "ps", "--format", "'{{.ID}}'"}) checkls.WaitWithDefaultTimeout() - Expect(checkls).Should(Exit(0)) + Expect(checkls).Should(ExitCleanly()) Expect(checkls.OutputToStringArray()).To(BeEmpty()) }) - It("podman play kube teardown with secret", func() { + It("teardown with secret", func() { err := writeYaml(secretYaml, kubeYaml) Expect(err).ToNot(HaveOccurred()) kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) ls := podmanTest.Podman([]string{"secret", "ls", "--format", "{{.ID}}"}) ls.WaitWithDefaultTimeout() - Expect(ls).Should(Exit(0)) + Expect(ls).Should(ExitCleanly()) Expect(ls.OutputToStringArray()).To(HaveLen(1)) teardown := podmanTest.Podman([]string{"kube", "down", kubeYaml}) teardown.WaitWithDefaultTimeout() - Expect(teardown).Should(Exit(0)) + Expect(teardown).Should(ExitCleanly()) Expect(teardown.OutputToString()).Should(ContainSubstring(ls.OutputToString())) // Removing a 2nd time to make sure no "no such error" is returned (see #19711) teardown = podmanTest.Podman([]string{"kube", "down", kubeYaml}) teardown.WaitWithDefaultTimeout() - Expect(teardown).Should(Exit(0)) + Expect(teardown).Should(ExitCleanly()) checkls := podmanTest.Podman([]string{"secret", "ls", "--format", "'{{.ID}}'"}) checkls.WaitWithDefaultTimeout() - Expect(checkls).Should(Exit(0)) + Expect(checkls).Should(ExitCleanly()) Expect(checkls.OutputToStringArray()).To(BeEmpty()) }) - It("podman play kube teardown pod does not exist", func() { + It("teardown pod does not exist", func() { err := writeYaml(simplePodYaml, kubeYaml) Expect(err).ToNot(HaveOccurred()) - teardown := podmanTest.Podman([]string{"play", "kube", "--down", kubeYaml}) + teardown := podmanTest.Podman([]string{"kube", "play", "--down", kubeYaml}) teardown.WaitWithDefaultTimeout() - Expect(teardown).Should(Exit(0)) + Expect(teardown).Should(ExitCleanly()) }) - It("podman play kube teardown volume --force", func() { + It("teardown volume --force", func() { volName := RandomString(12) volDevice := define.TypeTmpfs @@ -4243,32 +4281,32 @@ invalid kube kind err = generateKubeYaml("persistentVolumeClaim", pvc, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) exists := podmanTest.Podman([]string{"volume", "exists", volName}) exists.WaitWithDefaultTimeout() - Expect(exists).To(Exit(0)) + Expect(exists).To(ExitCleanly()) - teardown := podmanTest.Podman([]string{"play", "kube", "--down", kubeYaml}) + teardown := podmanTest.Podman([]string{"kube", "play", "--down", kubeYaml}) teardown.WaitWithDefaultTimeout() - Expect(teardown).To(Exit(0)) + Expect(teardown).To(ExitCleanly()) // volume should not be deleted on teardown without --force exists = podmanTest.Podman([]string{"volume", "exists", volName}) exists.WaitWithDefaultTimeout() - Expect(exists).To(Exit(0)) + Expect(exists).To(ExitCleanly()) // volume gets deleted with --force - teardown = podmanTest.Podman([]string{"play", "kube", "--down", "--force", kubeYaml}) + teardown = podmanTest.Podman([]string{"kube", "play", "--down", "--force", kubeYaml}) teardown.WaitWithDefaultTimeout() - Expect(teardown).To(Exit(0)) + Expect(teardown).To(ExitCleanly()) // Removing a 2nd should succeed as well even if no volume matches - teardown = podmanTest.Podman([]string{"play", "kube", "--down", "--force", kubeYaml}) + teardown = podmanTest.Podman([]string{"kube", "play", "--down", "--force", kubeYaml}) teardown.WaitWithDefaultTimeout() - Expect(teardown).To(Exit(0)) + Expect(teardown).To(ExitCleanly()) // volume should not be deleted on teardown exists = podmanTest.Podman([]string{"volume", "exists", volName}) @@ -4276,7 +4314,7 @@ invalid kube kind Expect(exists).To(Exit(1)) }) - It("podman play kube after teardown with volume reuse", func() { + It("after teardown with volume reuse", func() { volName := RandomString(12) volDevice := define.TypeTmpfs @@ -4290,29 +4328,29 @@ invalid kube kind err = generateKubeYaml("persistentVolumeClaim", pvc, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) exists := podmanTest.Podman([]string{"volume", "exists", volName}) exists.WaitWithDefaultTimeout() - Expect(exists).To(Exit(0)) + Expect(exists).To(ExitCleanly()) - teardown := podmanTest.Podman([]string{"play", "kube", "--down", kubeYaml}) + teardown := podmanTest.Podman([]string{"kube", "play", "--down", kubeYaml}) teardown.WaitWithDefaultTimeout() - Expect(teardown).To(Exit(0)) + Expect(teardown).To(ExitCleanly()) // volume should not be deleted on teardown exists = podmanTest.Podman([]string{"volume", "exists", volName}) exists.WaitWithDefaultTimeout() - Expect(exists).To(Exit(0)) + Expect(exists).To(ExitCleanly()) - restart := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + restart := podmanTest.Podman([]string{"kube", "play", kubeYaml}) restart.WaitWithDefaultTimeout() - Expect(restart).To(Exit(0)) + Expect(restart).To(ExitCleanly()) }) - It("podman play kube use network mode from config", func() { + It("use network mode from config", func() { confPath, err := filepath.Abs("config/containers-netns2.conf") Expect(err).ToNot(HaveOccurred()) os.Setenv("CONTAINERS_CONF", confPath) @@ -4324,38 +4362,38 @@ invalid kube kind err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) podInspect := podmanTest.Podman([]string{"pod", "inspect", pod.Name, "--format", "{{.InfraContainerID}}"}) podInspect.WaitWithDefaultTimeout() - Expect(podInspect).To(Exit(0)) + Expect(podInspect).To(ExitCleanly()) infraID := podInspect.OutputToString() inspect := podmanTest.Podman([]string{"inspect", "--format", "{{.HostConfig.NetworkMode}}", infraID}) inspect.WaitWithDefaultTimeout() - Expect(inspect).To(Exit(0)) + Expect(inspect).To(ExitCleanly()) Expect(inspect.OutputToString()).To(Equal("bridge")) }) - It("podman play kube replace", func() { + It("replace", func() { pod := getPod() err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) ls := podmanTest.Podman([]string{"pod", "ps", "--format", "'{{.ID}}'"}) ls.WaitWithDefaultTimeout() - Expect(ls).Should(Exit(0)) + Expect(ls).Should(ExitCleanly()) Expect(ls.OutputToStringArray()).To(HaveLen(1)) containerLen := podmanTest.Podman([]string{"pod", "inspect", pod.Name, "--format", "{{len .Containers}}"}) containerLen.WaitWithDefaultTimeout() - Expect(containerLen).Should(Exit(0)) + Expect(containerLen).Should(ExitCleanly()) Expect(containerLen.OutputToString()).To(Equal("2")) ctr01Name := "ctr01" ctr02Name := "ctr02" @@ -4370,32 +4408,32 @@ invalid kube kind err = generateKubeYaml("pod", newPod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - replace := podmanTest.Podman([]string{"play", "kube", "--replace", kubeYaml}) + replace := podmanTest.Podman([]string{"kube", "play", "--replace", kubeYaml}) replace.WaitWithDefaultTimeout() - Expect(replace).Should(Exit(0)) + Expect(replace).Should(ExitCleanly()) newContainerLen := podmanTest.Podman([]string{"pod", "inspect", newPod.Name, "--format", "{{len .Containers}}"}) newContainerLen.WaitWithDefaultTimeout() - Expect(newContainerLen).Should(Exit(0)) + Expect(newContainerLen).Should(ExitCleanly()) Expect(newContainerLen.OutputToString()).NotTo(Equal(containerLen.OutputToString())) }) - It("podman play kube replace non-existing pod", func() { + It("replace non-existing pod", func() { pod := getPod() err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - replace := podmanTest.Podman([]string{"play", "kube", "--replace", kubeYaml}) + replace := podmanTest.Podman([]string{"kube", "play", "--replace", kubeYaml}) replace.WaitWithDefaultTimeout() - Expect(replace).Should(Exit(0)) + Expect(replace).Should(ExitCleanly()) ls := podmanTest.Podman([]string{"pod", "ps", "--format", "'{{.ID}}'"}) ls.WaitWithDefaultTimeout() - Expect(ls).Should(Exit(0)) + Expect(ls).Should(ExitCleanly()) Expect(ls.OutputToStringArray()).To(HaveLen(1)) }) - It("podman play kube RunAsUser", func() { + It("RunAsUser", func() { ctr1Name := "ctr1" ctr2Name := "ctr2" ctr1 := getCtr(withName(ctr1Name), withSecurityContext(true), withRunAsUser("101"), withRunAsGroup("102")) @@ -4412,9 +4450,9 @@ invalid kube kind err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - cmd := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + cmd := podmanTest.Podman([]string{"kube", "play", kubeYaml}) cmd.WaitWithDefaultTimeout() - Expect(cmd).Should(Exit(0)) + Expect(cmd).Should(ExitCleanly()) // we expect the user:group as configured for the container inspect := podmanTest.Podman([]string{"container", "inspect", "--format", "'{{.Config.User}}'", makeCtrNameInPod(pod, ctr1Name)}) @@ -4445,7 +4483,7 @@ invalid kube kind ENV JAVA_TOOL_OPTIONS=%q ENV OPENJ9_JAVA_OPTIONS=%q `, - ALPINE, javaToolOptions, openj9JavaOptions) + CITEST_IMAGE, javaToolOptions, openj9JavaOptions) image := "podman-kube-test:env" podmanTest.BuildImage(containerfile, image, "false") @@ -4453,13 +4491,13 @@ ENV OPENJ9_JAVA_OPTIONS=%q pod := getPod(withCtr(ctnr)) Expect(generateKubeYaml("pod", pod, kubeYaml)).Should(Succeed()) - play := podmanTest.Podman([]string{"play", "kube", "--start", kubeYaml}) + play := podmanTest.Podman([]string{"kube", "play", "--start", kubeYaml}) play.WaitWithDefaultTimeout() - Expect(play).Should(Exit(0)) + Expect(play).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"container", "inspect", "--format=json", getCtrNameInPod(pod)}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) contents := string(inspect.Out.Contents()) Expect(contents).To(ContainSubstring(javaToolOptions)) @@ -4468,7 +4506,7 @@ ENV OPENJ9_JAVA_OPTIONS=%q }) Context("with configmap in multi-doc yaml", func() { - It("podman play kube uses env value", func() { + It("uses env value", func() { cm := getConfigMap(withConfigMapName("foo"), withConfigMapData("FOO", "foo")) cmYaml, err := getKubeYaml("configmap", cm) @@ -4483,17 +4521,17 @@ ENV OPENJ9_JAVA_OPTIONS=%q err = generateMultiDocKubeYaml(yamls, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Env }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(`FOO=foo`)) }) - It("podman play kube fails for required env value with missing key", func() { + It("fails for required env value with missing key", func() { cm := getConfigMap(withConfigMapName("foo"), withConfigMapData("FOO", "foo")) cmYaml, err := getKubeYaml("configmap", cm) @@ -4508,12 +4546,12 @@ ENV OPENJ9_JAVA_OPTIONS=%q err = generateMultiDocKubeYaml(yamls, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).To(ExitWithError()) }) - It("podman play kube succeeds for optional env value with missing key", func() { + It("succeeds for optional env value with missing key", func() { cm := getConfigMap(withConfigMapName("foo"), withConfigMapData("FOO", "foo")) cmYaml, err := getKubeYaml("configmap", cm) @@ -4528,17 +4566,17 @@ ENV OPENJ9_JAVA_OPTIONS=%q err = generateMultiDocKubeYaml(yamls, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ range .Config.Env }}[{{ . }}]{{end}}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(Not(ContainSubstring(`[FOO=]`))) }) - It("podman play kube uses all key-value pairs as envs", func() { + It("uses all key-value pairs as envs", func() { cm := getConfigMap(withConfigMapName("foo"), withConfigMapData("FOO1", "foo1"), withConfigMapData("FOO2", "foo2")) cmYaml, err := getKubeYaml("configmap", cm) Expect(err).ToNot(HaveOccurred()) @@ -4552,18 +4590,18 @@ ENV OPENJ9_JAVA_OPTIONS=%q err = generateMultiDocKubeYaml(yamls, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Env }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(`FOO1=foo1`)) Expect(inspect.OutputToString()).To(ContainSubstring(`FOO2=foo2`)) }) - It("podman play kube deployment uses variable from config map", func() { + It("deployment uses variable from config map", func() { cm := getConfigMap(withConfigMapName("foo"), withConfigMapData("FOO", "foo")) cmYaml, err := getKubeYaml("configmap", cm) @@ -4578,18 +4616,18 @@ ENV OPENJ9_JAVA_OPTIONS=%q err = generateMultiDocKubeYaml(yamls, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", fmt.Sprintf("%s-%s-%s", deployment.Name, "pod", defaultCtrName), "--format", "'{{ .Config }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(`FOO=foo`)) }) - It("podman play kube uses env value from configmap for HTTP API client", func() { + It("uses env value from configmap for HTTP API client", func() { SkipIfRemote("cannot run in a remote setup") address := url.URL{ Scheme: "tcp", @@ -4622,13 +4660,13 @@ ENV OPENJ9_JAVA_OPTIONS=%q inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Env }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(`FOO=foo`)) }) }) Context("with configmap in multi-doc yaml and files", func() { - It("podman play kube uses env values from both sources", func() { + It("uses env values from both sources", func() { fsCmYamlPathname := filepath.Join(podmanTest.TempDir, "foo-cm.yaml") fsCm := getConfigMap(withConfigMapName("fooFs"), withConfigMapData("FOO_FS", "fooFS")) err := generateKubeYaml("configmap", fsCm, fsCmYamlPathname) @@ -4651,20 +4689,20 @@ ENV OPENJ9_JAVA_OPTIONS=%q err = generateMultiDocKubeYaml(yamls, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml, "--configmap", fsCmYamlPathname}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml, "--configmap", fsCmYamlPathname}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Env }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(And( ContainSubstring(`FOO=foo`), ContainSubstring(`FOO_FS=fooFS`), )) }) - It("podman play kube uses all env values from both sources", func() { + It("uses all env values from both sources", func() { fsCmYamlPathname := filepath.Join(podmanTest.TempDir, "foo-cm.yaml") fsCm := getConfigMap(withConfigMapName("fooFs"), withConfigMapData("FOO_FS_1", "fooFS1"), @@ -4692,13 +4730,13 @@ ENV OPENJ9_JAVA_OPTIONS=%q err = generateMultiDocKubeYaml(yamls, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml, "--configmap", fsCmYamlPathname}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml, "--configmap", fsCmYamlPathname}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .Config.Env }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(And( ContainSubstring(`FOO_1=foo1`), ContainSubstring(`FOO_2=foo2`), @@ -4707,7 +4745,7 @@ ENV OPENJ9_JAVA_OPTIONS=%q )) }) - It("podman play kube reports error when the same configmap name is present in both sources", func() { + It("reports error when the same configmap name is present in both sources", func() { // We will never hit this error in the remote case as the configmap content is appended to the main yaml content SkipIfRemote("--configmaps is appended to the main yaml for the remote case") @@ -4732,34 +4770,34 @@ ENV OPENJ9_JAVA_OPTIONS=%q err = generateMultiDocKubeYaml(yamls, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml, "--configmap", fsCmYamlPathname}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml, "--configmap", fsCmYamlPathname}) kube.WaitWithDefaultTimeout() Expect(kube).Should(Exit(125)) Expect(kube.ErrorToString()).To(ContainSubstring("ambiguous configuration: the same config map foo is present in YAML and in --configmaps")) }) }) - It("podman play kube --log-opt = tag test", func() { + It("--log-opt = tag test", func() { SkipIfContainerized("journald does not work inside the container") pod := getPod() err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml, "--log-driver", "journald", "--log-opt", "tag={{.ImageName}}"}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml, "--log-driver", "journald", "--log-opt", "tag={{.ImageName}}"}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) start := podmanTest.Podman([]string{"start", getCtrNameInPod(pod)}) start.WaitWithDefaultTimeout() - Expect(start).Should(Exit(0)) + Expect(start).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod)}) inspect.WaitWithDefaultTimeout() - Expect(start).Should(Exit(0)) + Expect(start).Should(ExitCleanly()) Expect((inspect.InspectContainerToJSON()[0]).HostConfig.LogConfig.Tag).To(Equal("{{.ImageName}}")) }) - It("podman play kube using a user namespace", func() { + It("using a user namespace", func() { u, err := user.Current() Expect(err).ToNot(HaveOccurred()) name := u.Username @@ -4789,43 +4827,43 @@ ENV OPENJ9_JAVA_OPTIONS=%q err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) usernsInCtr := podmanTest.Podman([]string{"exec", getCtrNameInPod(pod), "cat", "/proc/self/uid_map"}) usernsInCtr.WaitWithDefaultTimeout() - Expect(usernsInCtr).Should(Exit(0)) + Expect(usernsInCtr).Should(ExitCleanly()) // the conversion to string is needed for better error messages Expect(string(usernsInCtr.Out.Contents())).To(Equal(string(initialUsernsConfig))) - // PodmanNoCache is a workaround for https://github.com/containers/storage/issues/1232 - kube = podmanTest.PodmanNoCache([]string{"play", "kube", "--replace", "--userns=auto", kubeYaml}) + // -q necessary for ExitCleanly() because --replace pulls image + kube = podmanTest.Podman([]string{"kube", "play", "-q", "--replace", "--userns=auto", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) usernsInCtr = podmanTest.Podman([]string{"exec", getCtrNameInPod(pod), "cat", "/proc/self/uid_map"}) usernsInCtr.WaitWithDefaultTimeout() - Expect(usernsInCtr).Should(Exit(0)) + Expect(usernsInCtr).Should(ExitCleanly()) Expect(string(usernsInCtr.Out.Contents())).To(Not(Equal(string(initialUsernsConfig)))) - kube = podmanTest.PodmanNoCache([]string{"play", "kube", "--replace", "--userns=keep-id", kubeYaml}) + kube = podmanTest.PodmanNoCache([]string{"kube", "play", "-q", "--replace", "--userns=keep-id", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) usernsInCtr = podmanTest.Podman([]string{"exec", getCtrNameInPod(pod), "id", "-u"}) usernsInCtr.WaitWithDefaultTimeout() - Expect(usernsInCtr).Should(Exit(0)) + Expect(usernsInCtr).Should(ExitCleanly()) uid := fmt.Sprintf("%d", os.Geteuid()) Expect(string(usernsInCtr.Out.Contents())).To(ContainSubstring(uid)) - kube = podmanTest.PodmanNoCache([]string{"play", "kube", "--replace", "--userns=keep-id:uid=10,gid=12", kubeYaml}) + kube = podmanTest.PodmanNoCache([]string{"kube", "play", "--replace", "--userns=keep-id:uid=10,gid=12", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) usernsInCtr = podmanTest.Podman([]string{"exec", getCtrNameInPod(pod), "sh", "-c", "echo $(id -u):$(id -g)"}) usernsInCtr.WaitWithDefaultTimeout() - Expect(usernsInCtr).Should(Exit(0)) + Expect(usernsInCtr).Should(ExitCleanly()) Expect(string(usernsInCtr.Out.Contents())).To(ContainSubstring("10:12")) // Now try with hostUsers in the pod spec @@ -4834,13 +4872,13 @@ ENV OPENJ9_JAVA_OPTIONS=%q err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube = podmanTest.PodmanNoCache([]string{"play", "kube", "--replace", kubeYaml}) + kube = podmanTest.PodmanNoCache([]string{"kube", "play", "--replace", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) usernsInCtr = podmanTest.Podman([]string{"exec", getCtrNameInPod(pod), "cat", "/proc/self/uid_map"}) usernsInCtr.WaitWithDefaultTimeout() - Expect(usernsInCtr).Should(Exit(0)) + Expect(usernsInCtr).Should(ExitCleanly()) if hostUsers { Expect(string(usernsInCtr.Out.Contents())).To(Equal(string(initialUsernsConfig))) } else { @@ -4850,7 +4888,7 @@ ENV OPENJ9_JAVA_OPTIONS=%q }) // Check the block devices are exposed inside container - It("podman play kube expose block device inside container", func() { + It("expose block device inside container", func() { SkipIfRootless("It needs root access to create devices") // randomize the folder name to avoid error when running tests with multiple nodes @@ -4863,7 +4901,7 @@ ENV OPENJ9_JAVA_OPTIONS=%q devicePath := fmt.Sprintf("%s/blockdevice", devFolder) mknod := SystemExec("mknod", []string{devicePath, "b", "7", "0"}) mknod.WaitWithDefaultTimeout() - Expect(mknod).Should(Exit(0)) + Expect(mknod).Should(ExitCleanly()) blockVolume := getHostPathVolume("BlockDevice", devicePath) @@ -4871,25 +4909,25 @@ ENV OPENJ9_JAVA_OPTIONS=%q err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) // Container should be in running state inspect := podmanTest.Podman([]string{"inspect", "--format", "{{.State.Status}}", "testPod-" + defaultCtrName}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring("running")) // Container should have a block device /dev/loop1 inspect = podmanTest.Podman([]string{"inspect", "--format", "{{.HostConfig.Devices}}", "testPod-" + defaultCtrName}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(devicePath)) }) // Check the char devices are exposed inside container - It("podman play kube expose character device inside container", func() { + It("expose character device inside container", func() { SkipIfRootless("It needs root access to create devices") // randomize the folder name to avoid error when running tests with multiple nodes @@ -4902,7 +4940,7 @@ ENV OPENJ9_JAVA_OPTIONS=%q devicePath := fmt.Sprintf("%s/chardevice", devFolder) mknod := SystemExec("mknod", []string{devicePath, "c", "3", "1"}) mknod.WaitWithDefaultTimeout() - Expect(mknod).Should(Exit(0)) + Expect(mknod).Should(ExitCleanly()) charVolume := getHostPathVolume("CharDevice", devicePath) @@ -4910,24 +4948,24 @@ ENV OPENJ9_JAVA_OPTIONS=%q err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) // Container should be in running state inspect := podmanTest.Podman([]string{"inspect", "--format", "{{.State.Status}}", "testPod-" + defaultCtrName}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring("running")) // Container should have a block device /dev/loop1 inspect = podmanTest.Podman([]string{"inspect", "--format", "{{.HostConfig.Devices}}", "testPod-" + defaultCtrName}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(devicePath)) }) - It("podman play kube reports error when the device does not exist", func() { + It("reports error when the device does not exist", func() { SkipIfRootless("It needs root access to create devices") devicePath := "/dev/foodevdir/baddevice" @@ -4938,12 +4976,12 @@ ENV OPENJ9_JAVA_OPTIONS=%q err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).Should(Exit(125)) }) - It("podman play kube reports error when we try to expose char device as block device", func() { + It("reports error when we try to expose char device as block device", func() { SkipIfRootless("It needs root access to create devices") // randomize the folder name to avoid error when running tests with multiple nodes @@ -4956,7 +4994,7 @@ ENV OPENJ9_JAVA_OPTIONS=%q devicePath := fmt.Sprintf("%s/chardevice", devFolder) mknod := SystemExec("mknod", []string{devicePath, "c", "3", "1"}) mknod.WaitWithDefaultTimeout() - Expect(mknod).Should(Exit(0)) + Expect(mknod).Should(ExitCleanly()) charVolume := getHostPathVolume("BlockDevice", devicePath) @@ -4964,12 +5002,12 @@ ENV OPENJ9_JAVA_OPTIONS=%q err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).Should(Exit(125)) }) - It("podman play kube reports error when we try to expose block device as char device", func() { + It("reports error when we try to expose block device as char device", func() { SkipIfRootless("It needs root access to create devices") // randomize the folder name to avoid error when running tests with multiple nodes @@ -4981,7 +5019,7 @@ ENV OPENJ9_JAVA_OPTIONS=%q devicePath := fmt.Sprintf("%s/blockdevice", devFolder) mknod := SystemExec("mknod", []string{devicePath, "b", "7", "0"}) mknod.WaitWithDefaultTimeout() - Expect(mknod).Should(Exit(0)) + Expect(mknod).Should(ExitCleanly()) charVolume := getHostPathVolume("CharDevice", devicePath) @@ -4989,25 +5027,25 @@ ENV OPENJ9_JAVA_OPTIONS=%q err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).Should(Exit(125)) }) - It("podman play kube secret as volume support - simple", func() { + It("secret as volume support - simple", func() { createAndTestSecret(podmanTest, secretYaml, "newsecret", kubeYaml) testPodWithSecret(podmanTest, secretPodYaml, kubeYaml, true, true) deleteAndTestSecret(podmanTest, "newsecret") }) - It("podman play kube secret as volume support - multiple volumes", func() { + It("secret as volume support - multiple volumes", func() { yamls := []string{secretYaml, secretPodYaml} err = generateMultiDocKubeYaml(yamls, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) // do not remove newsecret to test that we auto remove on collision @@ -5015,37 +5053,37 @@ ENV OPENJ9_JAVA_OPTIONS=%q err = generateMultiDocKubeYaml(yamls, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube = podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube = podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) err = writeYaml(secretPodYamlTwo, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube = podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube = podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) exec := podmanTest.Podman([]string{"exec", "mypod2-myctr", "cat", "/etc/foo/username"}) exec.WaitWithDefaultTimeout() - Expect(exec).Should(Exit(0)) + Expect(exec).Should(ExitCleanly()) username, _ := base64.StdEncoding.DecodeString("dXNlcg==") Expect(exec.OutputToString()).Should(ContainSubstring(string(username))) exec = podmanTest.Podman([]string{"exec", "mypod2-myctr", "cat", "/etc/bar/username"}) exec.WaitWithDefaultTimeout() - Expect(exec).Should(Exit(0)) + Expect(exec).Should(ExitCleanly()) username, _ = base64.StdEncoding.DecodeString("Y2RvZXJu") Expect(exec.OutputToString()).Should(ContainSubstring(string(username))) exec = podmanTest.Podman([]string{"exec", "mypod2-myctr", "cat", "/etc/baz/plain_note"}) exec.WaitWithDefaultTimeout() - Expect(exec).Should(Exit(0)) + Expect(exec).Should(ExitCleanly()) Expect(exec.OutputToString()).Should(ContainSubstring("This is a test")) }) - It("podman play kube secret as volume support - optional field", func() { + It("secret as volume support - optional field", func() { createAndTestSecret(podmanTest, secretYaml, "newsecret", kubeYaml) testPodWithSecret(podmanTest, optionalExistingSecretPodYaml, kubeYaml, true, true) @@ -5056,13 +5094,13 @@ ENV OPENJ9_JAVA_OPTIONS=%q deleteAndTestSecret(podmanTest, "newsecret") }) - It("podman play kube secret as volume with no items", func() { + It("secret as volume with no items", func() { volumeName := "secretVol" secret := getSecret(withSecretName(volumeName), withSecretData("FOO", "testuser")) secretYaml, err := getKubeYaml("secret", secret) Expect(err).ToNot(HaveOccurred()) - ctr := getCtr(withVolumeMount("/test", "", false), withImage(BB)) + ctr := getCtr(withVolumeMount("/test", "", false), withImage(CITEST_IMAGE)) pod := getPod(withVolume(getSecretVolume(volumeName, []map[string]string{}, false)), withCtr(ctr)) podYaml, err := getKubeYaml("pod", pod) Expect(err).ToNot(HaveOccurred()) @@ -5072,15 +5110,15 @@ ENV OPENJ9_JAVA_OPTIONS=%q kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) secretData := podmanTest.Podman([]string{"exec", getCtrNameInPod(pod), "cat", "/test/FOO"}) secretData.WaitWithDefaultTimeout() - Expect(secretData).Should(Exit(0)) + Expect(secretData).Should(ExitCleanly()) Expect(secretData.OutputToString()).To(Equal("testuser")) }) - It("podman play kube secret as volume with items", func() { + It("secret as volume with items", func() { volumeName := "secretVol" secret := getSecret(withSecretName(volumeName), withSecretData("FOO", "foobar")) secretYaml, err := getKubeYaml("secret", secret) @@ -5090,7 +5128,7 @@ ENV OPENJ9_JAVA_OPTIONS=%q "path": "BAR", }} - ctr := getCtr(withVolumeMount("/test", "", false), withImage(BB)) + ctr := getCtr(withVolumeMount("/test", "", false), withImage(CITEST_IMAGE)) pod := getPod(withVolume(getSecretVolume(volumeName, volumeContents, false)), withCtr(ctr)) podYaml, err := getKubeYaml("pod", pod) Expect(err).ToNot(HaveOccurred()) @@ -5100,19 +5138,19 @@ ENV OPENJ9_JAVA_OPTIONS=%q kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) secretData := podmanTest.Podman([]string{"exec", getCtrNameInPod(pod), "cat", "/test/BAR"}) secretData.WaitWithDefaultTimeout() - Expect(secretData).Should(Exit(0)) + Expect(secretData).Should(ExitCleanly()) Expect(secretData.OutputToString()).To(Equal("foobar")) secretData = podmanTest.Podman([]string{"exec", getCtrNameInPod(pod), "cat", "/test/FOO"}) secretData.WaitWithDefaultTimeout() - Expect(secretData).Should(Not(Exit(0))) + Expect(secretData).Should(Not(ExitCleanly())) }) - It("podman play kube with disabled cgroup", func() { + It("with disabled cgroup", func() { SkipIfRunc(podmanTest, "Test not supported with runc (issue 17436, wontfix)") conffile := filepath.Join(podmanTest.TempDir, "container.conf") // Disabled ipcns and cgroupfs in the config file @@ -5127,9 +5165,9 @@ cgroups="disabled"`), 0644) err = writeYaml(simplePodYaml, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) }) It("podman kube --quiet with error", func() { @@ -5166,7 +5204,7 @@ spec: Expect(kube.ErrorToString()).To(Not(ContainSubstring("Error: %!s()"))) }) - It("podman kube play invalid yaml should clean up pod that was created before failure", func() { + It("invalid yaml should clean up pod that was created before failure", func() { podTemplate := `--- apiVersion: v1 kind: Pod @@ -5191,48 +5229,48 @@ spec: ps := podmanTest.Podman([]string{"pod", "ps", "-q"}) ps.WaitWithDefaultTimeout() - Expect(ps).Should(Exit(0)) + Expect(ps).Should(ExitCleanly()) Expect(ps.OutputToStringArray()).To(BeEmpty()) }) - It("podman play kube with named volume subpaths", func() { + It("with named volume subpaths", func() { SkipIfRemote("volume export does not exist on remote") volumeCreate := podmanTest.Podman([]string{"volume", "create", "testvol1"}) volumeCreate.WaitWithDefaultTimeout() - Expect(volumeCreate).Should(Exit(0)) + Expect(volumeCreate).Should(ExitCleanly()) - session := podmanTest.Podman([]string{"run", "--volume", "testvol1:/data", ALPINE, "sh", "-c", "mkdir -p /data/testing/onlythis && touch /data/testing/onlythis/123.txt && echo hi >> /data/testing/onlythis/123.txt"}) + session := podmanTest.Podman([]string{"run", "--volume", "testvol1:/data", CITEST_IMAGE, "sh", "-c", "mkdir -p /data/testing/onlythis && touch /data/testing/onlythis/123.txt && echo hi >> /data/testing/onlythis/123.txt"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) tar := filepath.Join(podmanTest.TempDir, "out.tar") session = podmanTest.Podman([]string{"volume", "export", "--output", tar, "testvol1"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) volumeCreate = podmanTest.Podman([]string{"volume", "create", "testvol"}) volumeCreate.WaitWithDefaultTimeout() - Expect(volumeCreate).Should(Exit(0)) + Expect(volumeCreate).Should(ExitCleanly()) volumeImp := podmanTest.Podman([]string{"volume", "import", "testvol", filepath.Join(podmanTest.TempDir, "out.tar")}) volumeImp.WaitWithDefaultTimeout() - Expect(volumeImp).Should(Exit(0)) + Expect(volumeImp).Should(ExitCleanly()) err = writeYaml(subpathTestNamedVolume, kubeYaml) Expect(err).ToNot(HaveOccurred()) - playKube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + playKube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) playKube.WaitWithDefaultTimeout() - Expect(playKube).Should(Exit(0)) + Expect(playKube).Should(ExitCleanly()) exec := podmanTest.Podman([]string{"exec", "testpod-testctr", "cat", "/var/123.txt"}) exec.WaitWithDefaultTimeout() - Expect(exec).Should(Exit(0)) + Expect(exec).Should(ExitCleanly()) Expect(exec.OutputToString()).Should(Equal("hi")) teardown := podmanTest.Podman([]string{"kube", "down", "--force", kubeYaml}) teardown.WaitWithDefaultTimeout() - Expect(teardown).Should(Exit(0)) + Expect(teardown).Should(ExitCleanly()) Expect(teardown.OutputToString()).Should(ContainSubstring("testvol")) // kube down --force should remove volumes @@ -5240,11 +5278,11 @@ spec: // created volumes, testvol1 in this case checkVol := podmanTest.Podman([]string{"volume", "ls", "--format", "{{.Name}}"}) checkVol.WaitWithDefaultTimeout() - Expect(checkVol).Should(Exit(0)) + Expect(checkVol).Should(ExitCleanly()) Expect(checkVol.OutputToString()).To(Equal("testvol1")) }) - It("podman play kube with hostPath subpaths", func() { + It("with hostPath subpaths", func() { if !Containerized() { Skip("something is wrong with file permissions in CI or in the yaml creation. cannot ls or cat the fs unless in a container") } @@ -5260,52 +5298,52 @@ spec: err = file.Close() Expect(err).ToNot(HaveOccurred()) - pod := getPod(withPodName("testpod"), withCtr(getCtr(withImage(ALPINE), withName("testctr"), withCmd([]string{"top"}), withVolumeMount("/var", "testing/onlythis", false))), withVolume(getHostPathVolume("DirectoryOrCreate", hostPathLocation))) + pod := getPod(withPodName("testpod"), withCtr(getCtr(withImage(CITEST_IMAGE), withName("testctr"), withCmd([]string{"top"}), withVolumeMount("/var", "testing/onlythis", false))), withVolume(getHostPathVolume("DirectoryOrCreate", hostPathLocation))) err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).To(Not(HaveOccurred())) - playKube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + playKube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) playKube.WaitWithDefaultTimeout() - Expect(playKube).Should(Exit(0)) + Expect(playKube).Should(ExitCleanly()) exec := podmanTest.Podman([]string{"exec", "testpod-testctr", "ls", "/var"}) exec.WaitWithDefaultTimeout() - Expect(exec).Should(Exit(0)) + Expect(exec).Should(ExitCleanly()) Expect(exec.OutputToString()).Should(ContainSubstring("123.txt")) }) - It("podman play kube with unsafe subpaths", func() { + It("with unsafe subpaths", func() { SkipIfRemote("volume export does not exist on remote") volumeCreate := podmanTest.Podman([]string{"volume", "create", "testvol1"}) volumeCreate.WaitWithDefaultTimeout() - Expect(volumeCreate).Should(Exit(0)) + Expect(volumeCreate).Should(ExitCleanly()) - session := podmanTest.Podman([]string{"run", "--volume", "testvol1:/data", ALPINE, "sh", "-c", "mkdir -p /data/testing && ln -s /etc /data/testing/onlythis"}) + session := podmanTest.Podman([]string{"run", "--volume", "testvol1:/data", CITEST_IMAGE, "sh", "-c", "mkdir -p /data/testing && ln -s /etc /data/testing/onlythis"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) tar := filepath.Join(podmanTest.TempDir, "out.tar") session = podmanTest.Podman([]string{"volume", "export", "--output", tar, "testvol1"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) volumeCreate = podmanTest.Podman([]string{"volume", "create", "testvol"}) volumeCreate.WaitWithDefaultTimeout() - Expect(volumeCreate).Should(Exit(0)) + Expect(volumeCreate).Should(ExitCleanly()) volumeImp := podmanTest.Podman([]string{"volume", "import", "testvol", filepath.Join(podmanTest.TempDir, "out.tar")}) volumeImp.WaitWithDefaultTimeout() - Expect(volumeImp).Should(Exit(0)) + Expect(volumeImp).Should(ExitCleanly()) err = writeYaml(subpathTestNamedVolume, kubeYaml) Expect(err).ToNot(HaveOccurred()) - playKube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + playKube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) playKube.WaitWithDefaultTimeout() Expect(playKube).Should(Exit(125)) Expect(playKube.OutputToString()).Should(ContainSubstring("is outside")) }) - It("podman play kube with unsafe hostPath subpaths", func() { + It("with unsafe hostPath subpaths", func() { if !Containerized() { Skip("something is wrong with file permissions in CI or in the yaml creation. cannot ls or cat the fs unless in a container") } @@ -5314,18 +5352,18 @@ spec: Expect(os.MkdirAll(filepath.Join(hostPathLocation, "testing"), 0755)).To(Succeed()) Expect(os.Symlink("/", filepath.Join(hostPathLocation, "testing", "symlink"))).To(Succeed()) - pod := getPod(withPodName("testpod"), withCtr(getCtr(withImage(ALPINE), withName("testctr"), withCmd([]string{"top"}), withVolumeMount("/foo", "testing/symlink", false))), withVolume(getHostPathVolume("DirectoryOrCreate", hostPathLocation))) + pod := getPod(withPodName("testpod"), withCtr(getCtr(withImage(CITEST_IMAGE), withName("testctr"), withCmd([]string{"top"}), withVolumeMount("/foo", "testing/symlink", false))), withVolume(getHostPathVolume("DirectoryOrCreate", hostPathLocation))) err = generateKubeYaml("pod", pod, kubeYaml) Expect(err).To(Not(HaveOccurred())) - playKube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + playKube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) playKube.WaitWithDefaultTimeout() Expect(playKube).Should(Exit(125)) Expect(playKube.OutputToString()).Should(ContainSubstring("is outside")) }) - It("podman play kube with configMap subpaths", func() { + It("with configMap subpaths", func() { volumeName := "cmVol" cm := getConfigMap(withConfigMapName(volumeName), withConfigMapData("FOO", "foobar")) cmYaml, err := getKubeYaml("configmap", cm) @@ -5335,7 +5373,7 @@ spec: "path": "BAR", }} - ctr := getCtr(withPullPolicy("always"), withName("testctr"), withCmd([]string{"top"}), withVolumeMount("/etc/BAR", "BAR", false), withImage(ALPINE)) + ctr := getCtr(withPullPolicy("always"), withName("testctr"), withCmd([]string{"top"}), withVolumeMount("/etc/BAR", "BAR", false), withImage(CITEST_IMAGE)) pod := getPod(withPodName("testpod"), withVolume(getConfigMapVolume(volumeName, volumeContents, false)), withCtr(ctr)) podYaml, err := getKubeYaml("pod", pod) @@ -5346,48 +5384,48 @@ spec: Expect(err).ToNot(HaveOccurred()) out, _ := os.ReadFile(kubeYaml) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).Should(Exit(0), string(out)) exec := podmanTest.Podman([]string{"exec", "testpod-testctr", "ls", "/etc/"}) exec.WaitWithDefaultTimeout() - Expect(exec).Should(Exit(0)) + Expect(exec).Should(ExitCleanly()) Expect(exec.OutputToString()).ShouldNot(HaveLen(3)) Expect(exec.OutputToString()).Should(ContainSubstring("BAR")) // we want to check that we can mount a subpath but not replace the entire dir }) - It("podman play kube without Ports - curl should fail", func() { + It("without Ports - curl should fail", func() { err := writeYaml(publishPortsPodWithoutPorts, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) curlTest := podmanTest.Podman([]string{"run", "--network", "host", NGINX_IMAGE, "curl", "-s", "localhost:19000"}) curlTest.WaitWithDefaultTimeout() Expect(curlTest).Should(Exit(7)) }) - It("podman play kube without Ports, publish in command line - curl should succeed", func() { + It("without Ports, publish in command line - curl should succeed", func() { err := writeYaml(publishPortsPodWithoutPorts, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", "--publish", "19002:80", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", "--publish", "19002:80", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) testHTTPServer("19002", false, "podman rulez") }) - It("podman play kube with privileged container ports - should fail", func() { + It("with privileged container ports - should fail", func() { SkipIfNotRootless("rootlessport can expose privileged port 80, no point in checking for failure") err := writeYaml(publishPortsPodWithContainerPort, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).Should(Exit(125)) // The error message is printed only on local call @@ -5396,80 +5434,80 @@ spec: } }) - It("podman play kube with privileged containers ports and publish in command line - curl should succeed", func() { + It("with privileged containers ports and publish in command line - curl should succeed", func() { err := writeYaml(publishPortsPodWithContainerPort, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", "--publish", "19003:80", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", "--publish", "19003:80", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) testHTTPServer("19003", false, "podman rulez") }) - It("podman play kube with Host Ports - curl should succeed", func() { + It("with Host Ports - curl should succeed", func() { err := writeYaml(publishPortsPodWithContainerHostPort, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", "--publish", "19004:80", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", "--publish", "19004:80", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) testHTTPServer("19004", false, "podman rulez") }) - It("podman play kube with Host Ports and publish in command line - curl should succeed only on overriding port", func() { + It("with Host Ports and publish in command line - curl should succeed only on overriding port", func() { err := writeYaml(publishPortsPodWithContainerHostPort, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", "--publish", "19005:80", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", "--publish", "19005:80", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) testHTTPServer("19001", true, "connection refused") testHTTPServer("19005", false, "podman rulez") }) - It("podman play kube multiple publish ports", func() { + It("multiple publish ports", func() { err := writeYaml(publishPortsPodWithoutPorts, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", "--publish", "19006:80", "--publish", "19007:80", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", "--publish", "19006:80", "--publish", "19007:80", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) testHTTPServer("19006", false, "podman rulez") testHTTPServer("19007", false, "podman rulez") }) - It("podman play kube override with tcp should keep udp from YAML file", func() { + It("override with tcp should keep udp from YAML file", func() { err := writeYaml(publishPortsEchoWithHostPortUDP, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", "--publish", "19010:19008/tcp", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", "--publish", "19010:19008/tcp", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) verifyPodPorts(podmanTest, "network-echo", "19008/tcp:[{ 19010}]", "19008/udp:[{ 19009}]") }) - It("podman play kube override with udp should keep tcp from YAML file", func() { + It("override with udp should keep tcp from YAML file", func() { err := writeYaml(publishPortsEchoWithHostPortTCP, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", "--publish", "19012:19008/udp", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", "--publish", "19012:19008/udp", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) verifyPodPorts(podmanTest, "network-echo", "19008/tcp:[{ 19011}]", "19008/udp:[{ 19012}]") }) - It("podman play kube with replicas limits the count to 1 and emits a warning", func() { + It("with replicas limits the count to 1 and emits a warning", func() { deployment := getDeployment(withReplicas(10)) err := generateKubeYaml("deployment", deployment, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).Should(Exit(0)) @@ -5482,40 +5520,40 @@ spec: Expect(strings.Count(kube.OutputToString(), "Container:")).To(Equal(1)) }) - It("podman play kube test with hostPID", func() { + It("test with hostPID", func() { err := writeYaml(podWithHostPIDDefined, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) - logs := podmanTest.Podman([]string{"pod", "logs", "-c", "test-hostpid-alpine", "test-hostpid"}) + logs := podmanTest.Podman([]string{"pod", "logs", "-c", "test-hostpid-testimage", "test-hostpid"}) logs.WaitWithDefaultTimeout() - Expect(logs).Should(Exit(0)) + Expect(logs).Should(ExitCleanly()) Expect(logs.OutputToString()).To(Not(Equal("1")), "PID should never be 1 because of host pidns") - inspect := podmanTest.Podman([]string{"inspect", "test-hostpid-alpine", "--format", "{{ .HostConfig.PidMode }}"}) + inspect := podmanTest.Podman([]string{"inspect", "test-hostpid-testimage", "--format", "{{ .HostConfig.PidMode }}"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(Equal("host")) }) - It("podman play kube test with hostIPC", func() { + It("test with hostIPC", func() { err := writeYaml(podWithHostIPCDefined, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) - wait := podmanTest.Podman([]string{"wait", "test-hostipc-alpine"}) + wait := podmanTest.Podman([]string{"wait", "test-hostipc-testimage"}) wait.WaitWithDefaultTimeout() - Expect(wait).Should(Exit(0)) + Expect(wait).Should(ExitCleanly()) - inspect := podmanTest.Podman([]string{"inspect", "test-hostipc-alpine", "--format", "{{ .HostConfig.IpcMode }}"}) + inspect := podmanTest.Podman([]string{"inspect", "test-hostipc-testimage", "--format", "{{ .HostConfig.IpcMode }}"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(Equal("host")) cmd := exec.Command("ls", "-l", "/proc/self/ns/ipc") @@ -5524,113 +5562,113 @@ spec: fields := strings.Split(string(res), " ") hostIpcNS := strings.TrimSuffix(fields[len(fields)-1], "\n") - logs := podmanTest.Podman([]string{"pod", "logs", "-c", "test-hostipc-alpine", "test-hostipc"}) + logs := podmanTest.Podman([]string{"pod", "logs", "-c", "test-hostipc-testimage", "test-hostipc"}) logs.WaitWithDefaultTimeout() - Expect(logs).Should(Exit(0)) + Expect(logs).Should(ExitCleanly()) fields = strings.Split(logs.OutputToString(), " ") ctrIpcNS := strings.TrimSuffix(fields[len(fields)-1], "\n") Expect(ctrIpcNS).To(Equal(hostIpcNS), "container IPC NS == host IPC NS") }) - It("podman play kube with ctrName should be in network alias", func() { + It("with ctrName should be in network alias", func() { ctrName := "test-ctr" ctrNameInKubePod := ctrName + "-pod-" + ctrName - session1 := podmanTest.Podman([]string{"run", "-d", "--name", ctrName, ALPINE, "top"}) + session1 := podmanTest.Podman([]string{"run", "-d", "--name", ctrName, CITEST_IMAGE, "top"}) session1.WaitWithDefaultTimeout() - Expect(session1).Should(Exit(0)) + Expect(session1).Should(ExitCleanly()) outputFile := filepath.Join(podmanTest.RunRoot, "pod.yaml") kube := podmanTest.Podman([]string{"kube", "generate", ctrName, "-f", outputFile}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) rm := podmanTest.Podman([]string{"pod", "rm", "-t", "0", "-f", ctrName}) rm.WaitWithDefaultTimeout() - Expect(rm).Should(Exit(0)) + Expect(rm).Should(ExitCleanly()) play := podmanTest.Podman([]string{"kube", "play", outputFile}) play.WaitWithDefaultTimeout() - Expect(play).Should(Exit(0)) + Expect(play).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", ctrNameInKubePod}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring("\"Aliases\": [ \"" + ctrName + "\"")) }) - It("podman play kube test with sysctl defined", func() { + It("test with sysctl defined", func() { SkipIfRootless("Network sysctls are not available for rootless") err := writeYaml(podWithSysctlDefined, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) - wait := podmanTest.Podman([]string{"wait", "test-sysctl-alpine"}) + wait := podmanTest.Podman([]string{"wait", "test-sysctl-testimage"}) wait.WaitWithDefaultTimeout() - Expect(wait).Should(Exit(0)) + Expect(wait).Should(ExitCleanly()) - logs := podmanTest.Podman([]string{"pod", "logs", "-c", "test-sysctl-alpine", "test-sysctl"}) + logs := podmanTest.Podman([]string{"pod", "logs", "-c", "test-sysctl-testimage", "test-sysctl"}) logs.WaitWithDefaultTimeout() - Expect(logs).Should(Exit(0)) + Expect(logs).Should(ExitCleanly()) Expect(logs.OutputToString()).To(ContainSubstring("kernel.msgmax = 65535")) Expect(logs.OutputToString()).To(ContainSubstring("net.core.somaxconn = 65535")) }) - It("podman play kube test with sysctl & host network defined", func() { + It("test with sysctl & host network defined", func() { SkipIfRootless("Network sysctls are not available for rootless") err := writeYaml(podWithSysctlHostNetDefined, kubeYaml) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) + kube := podmanTest.Podman([]string{"kube", "play", kubeYaml}) kube.WaitWithDefaultTimeout() Expect(kube).Should(Exit(125)) Expect(kube.ErrorToString()).To(ContainSubstring("since Network Namespace set to host: invalid argument")) }) - It("podman kube play test with --no-trunc", func() { + It("test with --no-trunc", func() { ctrName := "demo" vol1 := filepath.Join(podmanTest.TempDir, RandomString(99)) err := os.MkdirAll(vol1, 0755) Expect(err).ToNot(HaveOccurred()) - session := podmanTest.Podman([]string{"run", "-v", vol1 + ":/tmp/foo:Z", "--name", ctrName, ALPINE}) + session := podmanTest.Podman([]string{"run", "-v", vol1 + ":/tmp/foo:Z", "--name", ctrName, CITEST_IMAGE}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) file := filepath.Join(podmanTest.TempDir, ctrName+".yml") session = podmanTest.Podman([]string{"kube", "generate", "--no-trunc", "-f", file, ctrName}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"kube", "play", "--no-trunc", file}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) }) - It("podman kube play test with long annotation", func() { + It("test with long annotation", func() { ctrName := "demo" vol1 := filepath.Join(podmanTest.TempDir, RandomString(99)) err := os.MkdirAll(vol1, 0755) Expect(err).ToNot(HaveOccurred()) - session := podmanTest.Podman([]string{"run", "-v", vol1 + ":/tmp/foo:Z", "--name", ctrName, ALPINE}) + session := podmanTest.Podman([]string{"run", "-v", vol1 + ":/tmp/foo:Z", "--name", ctrName, CITEST_IMAGE}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) file := filepath.Join(podmanTest.TempDir, ctrName+".yml") session = podmanTest.Podman([]string{"kube", "generate", "--no-trunc", "-f", file, ctrName}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"kube", "play", file}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(125)) }) - It("podman play kube test with reserved volumes-from annotation in yaml", func() { + It("test with reserved volumes-from annotation in yaml", func() { ctr1 := "ctr1" ctr2 := "ctr2" ctrNameInKubePod := ctr2 + "-pod-" + ctr2 @@ -5640,203 +5678,203 @@ spec: err := os.MkdirAll(vol1, 0755) Expect(err).ToNot(HaveOccurred()) - session := podmanTest.Podman([]string{"create", "--name", ctr1, "-v", vol1, ALPINE}) + session := podmanTest.Podman([]string{"create", "--name", ctr1, "-v", vol1, CITEST_IMAGE}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) - session = podmanTest.Podman([]string{"create", "--volumes-from", ctr1, "--name", ctr2, ALPINE}) + session = podmanTest.Podman([]string{"create", "--volumes-from", ctr1, "--name", ctr2, CITEST_IMAGE}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) kube := podmanTest.Podman([]string{"kube", "generate", "--podman-only", "-f", outputFile, ctr2}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) play := podmanTest.Podman([]string{"kube", "play", outputFile}) play.WaitWithDefaultTimeout() - Expect(play).Should(Exit(0)) + Expect(play).Should(ExitCleanly()) inspectCtr2 := podmanTest.Podman([]string{"inspect", "-f", "'{{ .HostConfig.Binds }}'", ctrNameInKubePod}) inspectCtr2.WaitWithDefaultTimeout() - Expect(inspectCtr2).Should(Exit(0)) + Expect(inspectCtr2).Should(ExitCleanly()) Expect(inspectCtr2.OutputToString()).To(ContainSubstring(":" + vol1 + ":rw")) inspectCtr1 := podmanTest.Podman([]string{"inspect", "-f", "'{{ .HostConfig.Binds }}'", ctr1}) inspectCtr1.WaitWithDefaultTimeout() - Expect(inspectCtr1).Should(Exit(0)) + Expect(inspectCtr1).Should(ExitCleanly()) Expect(inspectCtr2.OutputToString()).To(Equal(inspectCtr1.OutputToString())) }) - It("podman kube play test with reserved autoremove annotation in yaml", func() { + It("test with reserved autoremove annotation in yaml", func() { ctr := "ctr" ctrNameInKubePod := ctr + "-pod-" + ctr outputFile := filepath.Join(podmanTest.TempDir, "pod.yaml") - session := podmanTest.Podman([]string{"create", "--rm", "--name", ctr, ALPINE}) + session := podmanTest.Podman([]string{"create", "--rm", "--name", ctr, CITEST_IMAGE}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) kube := podmanTest.Podman([]string{"kube", "generate", "--podman-only", "-f", outputFile, ctr}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) play := podmanTest.Podman([]string{"kube", "play", outputFile}) play.WaitWithDefaultTimeout() - Expect(play).Should(Exit(0)) + Expect(play).Should(ExitCleanly()) session = podmanTest.Podman([]string{"inspect", "-f", "{{ .HostConfig.AutoRemove }}", ctrNameInKubePod}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(session.OutputToString()).To(Equal("true")) }) - It("podman kube play test with reserved privileged annotation in yaml", func() { + It("test with reserved privileged annotation in yaml", func() { ctr := "ctr" ctrNameInKubePod := ctr + "-pod-" + ctr outputFile := filepath.Join(podmanTest.TempDir, "pod.yaml") - session := podmanTest.Podman([]string{"create", "--privileged", "--name", ctr, ALPINE}) + session := podmanTest.Podman([]string{"create", "--privileged", "--name", ctr, CITEST_IMAGE}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) kube := podmanTest.Podman([]string{"kube", "generate", "--podman-only", "-f", outputFile, ctr}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) play := podmanTest.Podman([]string{"kube", "play", outputFile}) play.WaitWithDefaultTimeout() - Expect(play).Should(Exit(0)) + Expect(play).Should(ExitCleanly()) session = podmanTest.Podman([]string{"inspect", "-f", "{{ .HostConfig.Privileged }}", ctrNameInKubePod}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(session.OutputToString()).To(Equal("true")) }) - It("podman kube play test with reserved init annotation in yaml", func() { + It("test with reserved init annotation in yaml", func() { ctr := "ctr" ctrNameInKubePod := ctr + "-pod-" + ctr outputFile := filepath.Join(podmanTest.TempDir, "pod.yaml") - session := podmanTest.Podman([]string{"create", "--init", "--name", ctr, ALPINE}) + session := podmanTest.Podman([]string{"create", "--init", "--name", ctr, CITEST_IMAGE}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) kube := podmanTest.Podman([]string{"kube", "generate", "--podman-only", "-f", outputFile, ctr}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) play := podmanTest.Podman([]string{"kube", "play", outputFile}) play.WaitWithDefaultTimeout() - Expect(play).Should(Exit(0)) + Expect(play).Should(ExitCleanly()) session = podmanTest.Podman([]string{"inspect", "-f", "{{ .Path }}", ctrNameInKubePod}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(session.OutputToString()).To(Equal("/run/podman-init")) }) - It("podman kube play test with reserved CIDFile annotation in yaml", func() { + It("test with reserved CIDFile annotation in yaml", func() { ctr := "ctr" ctrNameInKubePod := ctr + "-pod-" + ctr outputFile := filepath.Join(podmanTest.TempDir, "pod.yaml") cidFile := filepath.Join(podmanTest.TempDir, RandomString(10)+".txt") - session := podmanTest.Podman([]string{"create", "--cidfile", cidFile, "--name", ctr, ALPINE}) + session := podmanTest.Podman([]string{"create", "--cidfile", cidFile, "--name", ctr, CITEST_IMAGE}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) kube := podmanTest.Podman([]string{"kube", "generate", "--podman-only", "-f", outputFile, ctr}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) play := podmanTest.Podman([]string{"kube", "play", outputFile}) play.WaitWithDefaultTimeout() - Expect(play).Should(Exit(0)) + Expect(play).Should(ExitCleanly()) session = podmanTest.Podman([]string{"inspect", "-f", "{{ .HostConfig.ContainerIDFile }}", ctrNameInKubePod}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(session.OutputToString()).To(Equal(cidFile)) }) - It("podman kube play test with reserved Seccomp annotation in yaml", func() { + It("test with reserved Seccomp annotation in yaml", func() { ctr := "ctr" ctrNameInKubePod := ctr + "-pod-" + ctr outputFile := filepath.Join(podmanTest.TempDir, "pod.yaml") - session := podmanTest.Podman([]string{"create", "--security-opt", "seccomp=unconfined", "--name", ctr, ALPINE}) + session := podmanTest.Podman([]string{"create", "--security-opt", "seccomp=unconfined", "--name", ctr, CITEST_IMAGE}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) kube := podmanTest.Podman([]string{"kube", "generate", "--podman-only", "-f", outputFile, ctr}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) play := podmanTest.Podman([]string{"kube", "play", outputFile}) play.WaitWithDefaultTimeout() - Expect(play).Should(Exit(0)) + Expect(play).Should(ExitCleanly()) session = podmanTest.Podman([]string{"inspect", "-f", "{{ .HostConfig.SecurityOpt }}", ctrNameInKubePod}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(session.OutputToString()).To(Equal("[seccomp=unconfined]")) }) - It("podman kube play test with reserved Apparmor annotation in yaml", func() { + It("test with reserved Apparmor annotation in yaml", func() { ctr := "ctr" ctrNameInKubePod := ctr + "-pod-" + ctr outputFile := filepath.Join(podmanTest.TempDir, "pod.yaml") - session := podmanTest.Podman([]string{"create", "--security-opt", "apparmor=unconfined", "--name", ctr, ALPINE}) + session := podmanTest.Podman([]string{"create", "--security-opt", "apparmor=unconfined", "--name", ctr, CITEST_IMAGE}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) kube := podmanTest.Podman([]string{"kube", "generate", "--podman-only", "-f", outputFile, ctr}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) play := podmanTest.Podman([]string{"kube", "play", outputFile}) play.WaitWithDefaultTimeout() - Expect(play).Should(Exit(0)) + Expect(play).Should(ExitCleanly()) session = podmanTest.Podman([]string{"inspect", "-f", "{{ .HostConfig.SecurityOpt }}", ctrNameInKubePod}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(session.OutputToString()).To(Equal("[apparmor=unconfined]")) }) - It("podman kube play test with reserved Label annotation in yaml", func() { + It("test with reserved Label annotation in yaml", func() { ctr := "ctr" ctrNameInKubePod := ctr + "-pod-" + ctr outputFile := filepath.Join(podmanTest.TempDir, "pod.yaml") - session := podmanTest.Podman([]string{"create", "--security-opt", "label=level:s0", "--name", ctr, ALPINE}) + session := podmanTest.Podman([]string{"create", "--security-opt", "label=level:s0", "--name", ctr, CITEST_IMAGE}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) kube := podmanTest.Podman([]string{"kube", "generate", "--podman-only", "-f", outputFile, ctr}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) play := podmanTest.Podman([]string{"kube", "play", outputFile}) play.WaitWithDefaultTimeout() - Expect(play).Should(Exit(0)) + Expect(play).Should(ExitCleanly()) session = podmanTest.Podman([]string{"inspect", "-f", "{{ .HostConfig.SecurityOpt }}", ctrNameInKubePod}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(session.OutputToString()).To(Equal("[label=level:s0]")) }) - It("podman kube play test with reserved PublishAll annotation in yaml", func() { - podmanTest.AddImageToRWStore(ALPINE) + It("test with reserved PublishAll annotation in yaml", func() { + podmanTest.AddImageToRWStore(CITEST_IMAGE) dockerfile := fmt.Sprintf(`FROM %s EXPOSE 2002 EXPOSE 2001-2003 -EXPOSE 2004-2005/tcp`, ALPINE) +EXPOSE 2004-2005/tcp`, CITEST_IMAGE) imageName := "testimg" podmanTest.BuildImage(dockerfile, imageName, "false") @@ -5856,76 +5894,76 @@ EXPOSE 2004-2005/tcp`, ALPINE) session := podmanTest.Podman([]string{"create", "--publish-all", "--name", ctr, imageName, "true"}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) kube := podmanTest.Podman([]string{"kube", "generate", "--podman-only", "-f", outputFile, ctr}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) play := podmanTest.Podman([]string{"kube", "play", outputFile}) play.WaitWithDefaultTimeout() - Expect(play).Should(Exit(0)) + Expect(play).Should(ExitCleanly()) session = podmanTest.Podman([]string{"inspect", "-f", "{{ .HostConfig.PublishAllPorts }}", ctrNameInKubePod}) session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + Expect(session).Should(ExitCleanly()) Expect(session.OutputToString()).To(Equal("true")) }) - It("podman kube play test with valid Umask value", func() { + It("test with valid Umask value", func() { defaultUmask := "0022" ctrName := "ctr" ctrNameInPod := "ctr-pod-ctr" outputFile := filepath.Join(podmanTest.TempDir, "pod.yaml") - create := podmanTest.Podman([]string{"create", "-t", "--restart", "never", "--name", ctrName, ALPINE}) + create := podmanTest.Podman([]string{"create", "-t", "--restart", "never", "--name", ctrName, CITEST_IMAGE, "top"}) create.WaitWithDefaultTimeout() - Expect(create).Should(Exit(0)) + Expect(create).Should(ExitCleanly()) generate := podmanTest.Podman([]string{"kube", "generate", "-f", outputFile, ctrName}) generate.WaitWithDefaultTimeout() - Expect(generate).Should(Exit(0)) + Expect(generate).Should(ExitCleanly()) play := podmanTest.Podman([]string{"kube", "play", outputFile}) play.WaitWithDefaultTimeout() - Expect(play).Should(Exit(0)) + Expect(play).Should(ExitCleanly()) exec := podmanTest.Podman([]string{"exec", ctrNameInPod, "/bin/sh", "-c", "umask"}) exec.WaitWithDefaultTimeout() - Expect(exec).Should(Exit(0)) + Expect(exec).Should(ExitCleanly()) Expect(exec.OutputToString()).To(Equal(defaultUmask)) inspect := podmanTest.Podman([]string{"inspect", ctrNameInPod, "-f", "{{ .Config.Umask }}"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(Equal(defaultUmask)) }) // podman play with infra name annotation - It("podman play kube test with infra name annotation set", func() { + It("test with infra name annotation set", func() { infraName := "infra-ctr" podName := "mypod" outputFile := filepath.Join(podmanTest.TempDir, "pod.yaml") pod := podmanTest.Podman([]string{"pod", "create", "--infra-name", infraName, podName}) pod.WaitWithDefaultTimeout() - Expect(pod).Should(Exit(0)) + Expect(pod).Should(ExitCleanly()) - ctr := podmanTest.Podman([]string{"create", "--pod", podName, ALPINE, "top"}) + ctr := podmanTest.Podman([]string{"create", "--pod", podName, CITEST_IMAGE, "top"}) ctr.WaitWithDefaultTimeout() - Expect(ctr).Should(Exit(0)) + Expect(ctr).Should(ExitCleanly()) // Generate kube yaml and it should have the infra name annotation set gen := podmanTest.Podman([]string{"kube", "generate", "-f", outputFile, podName}) gen.WaitWithDefaultTimeout() - Expect(gen).Should(Exit(0)) + Expect(gen).Should(ExitCleanly()) // Remove the pod so it can be recreated via kube play rm := podmanTest.Podman([]string{"pod", "rm", "-f", podName}) rm.WaitWithDefaultTimeout() - Expect(rm).Should(Exit(0)) + Expect(rm).Should(ExitCleanly()) kube := podmanTest.Podman([]string{"kube", "play", outputFile}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) // Expect the number of containers created to be 2, infra, and regular container numOfCtrs := podmanTest.NumberOfContainers() @@ -5933,34 +5971,34 @@ EXPOSE 2004-2005/tcp`, ALPINE) ps := podmanTest.Podman([]string{"ps", "--format", "{{.Names}}"}) ps.WaitWithDefaultTimeout() - Expect(ps).Should(Exit(0)) + Expect(ps).Should(ExitCleanly()) Expect(ps.OutputToString()).To(ContainSubstring(infraName)) }) // podman play with default infra name - It("podman play kube test with default infra name", func() { + It("test with default infra name", func() { podName := "mypod" outputFile := filepath.Join(podmanTest.TempDir, "pod.yaml") pod := podmanTest.Podman([]string{"pod", "create", podName}) pod.WaitWithDefaultTimeout() - Expect(pod).Should(Exit(0)) + Expect(pod).Should(ExitCleanly()) - ctr := podmanTest.Podman([]string{"create", "--pod", podName, ALPINE, "top"}) + ctr := podmanTest.Podman([]string{"create", "--pod", podName, CITEST_IMAGE, "top"}) ctr.WaitWithDefaultTimeout() - Expect(ctr).Should(Exit(0)) + Expect(ctr).Should(ExitCleanly()) // Generate kube yaml and it should have the infra name annotation set gen := podmanTest.Podman([]string{"kube", "generate", "-f", outputFile, podName}) gen.WaitWithDefaultTimeout() - Expect(gen).Should(Exit(0)) + Expect(gen).Should(ExitCleanly()) // Remove the pod so it can be recreated via kube play rm := podmanTest.Podman([]string{"pod", "rm", "-f", podName}) rm.WaitWithDefaultTimeout() - Expect(rm).Should(Exit(0)) + Expect(rm).Should(ExitCleanly()) - kube := podmanTest.Podman([]string{"play", "kube", outputFile}) + kube := podmanTest.Podman([]string{"kube", "play", outputFile}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) // Expect the number of containers created to be 2, infra, and regular container numOfCtrs := podmanTest.NumberOfContainers() @@ -5968,50 +6006,50 @@ EXPOSE 2004-2005/tcp`, ALPINE) podPs := podmanTest.Podman([]string{"pod", "ps", "-q"}) podPs.WaitWithDefaultTimeout() - Expect(podPs).Should(Exit(0)) + Expect(podPs).Should(ExitCleanly()) podID := podPs.OutputToString() ps := podmanTest.Podman([]string{"ps", "--format", "{{.Names}}"}) ps.WaitWithDefaultTimeout() - Expect(ps).Should(Exit(0)) + Expect(ps).Should(ExitCleanly()) Expect(ps.OutputToString()).To(ContainSubstring(podID[:12] + "-infra")) }) - It("podman play kube support List kind", func() { + It("support List kind", func() { listYamlPathname := filepath.Join(podmanTest.TempDir, "list.yaml") err = writeYaml(listPodAndConfigMap, listYamlPathname) Expect(err).ToNot(HaveOccurred()) - kube := podmanTest.Podman([]string{"play", "kube", listYamlPathname}) + kube := podmanTest.Podman([]string{"kube", "play", listYamlPathname}) kube.WaitWithDefaultTimeout() - Expect(kube).Should(Exit(0)) + Expect(kube).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", "test-list-pod-container", "--format", "'{{ .Config.Env }}'"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(ContainSubstring(`FOO=bar`)) }) - It("podman kube play with TerminationGracePeriodSeconds set", func() { + It("with TerminationGracePeriodSeconds set", func() { ctrName := "ctr" ctrNameInPod := "ctr-pod-ctr" outputFile := filepath.Join(podmanTest.TempDir, "pod.yaml") - create := podmanTest.Podman([]string{"create", "--restart", "never", "--stop-timeout", "20", "--name", ctrName, ALPINE}) + create := podmanTest.Podman([]string{"create", "--restart", "never", "--stop-timeout", "20", "--name", ctrName, CITEST_IMAGE}) create.WaitWithDefaultTimeout() - Expect(create).Should(Exit(0)) + Expect(create).Should(ExitCleanly()) generate := podmanTest.Podman([]string{"kube", "generate", "-f", outputFile, ctrName}) generate.WaitWithDefaultTimeout() - Expect(generate).Should(Exit(0)) + Expect(generate).Should(ExitCleanly()) play := podmanTest.Podman([]string{"kube", "play", outputFile}) play.WaitWithDefaultTimeout() - Expect(play).Should(Exit(0)) + Expect(play).Should(ExitCleanly()) inspect := podmanTest.Podman([]string{"inspect", ctrNameInPod, "-f", "{{ .Config.StopTimeout }}"}) inspect.WaitWithDefaultTimeout() - Expect(inspect).Should(Exit(0)) + Expect(inspect).Should(ExitCleanly()) Expect(inspect.OutputToString()).To(Equal("20")) }) })