diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/play_kube_test.go | 17 | ||||
-rw-r--r-- | test/system/700-play.bats | 45 |
2 files changed, 57 insertions, 5 deletions
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go index 6d89a844e..46a8e88bc 100644 --- a/test/e2e/play_kube_test.go +++ b/test/e2e/play_kube_test.go @@ -2779,11 +2779,7 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`}) }) It("podman play kube test with HostNetwork", func() { - if !strings.Contains(podmanTest.OCIRuntime, "crun") { - Skip("Test only works on crun") - } - - pod := getPod(withHostNetwork()) + pod := getPod(withHostNetwork(), withCtr(getCtr(withCmd([]string{"readlink", "/proc/self/ns/net"}), withArg(nil)))) err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).To(BeNil()) @@ -2795,6 +2791,17 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`}) inspect.WaitWithDefaultTimeout() Expect(inspect).Should(Exit(0)) Expect(inspect.OutputToString()).To(Equal("true")) + + ns := SystemExec("readlink", []string{"/proc/self/ns/net"}) + ns.WaitWithDefaultTimeout() + Expect(ns).Should(Exit(0)) + netns := ns.OutputToString() + Expect(netns).ToNot(BeEmpty()) + + logs := podmanTest.Podman([]string{"logs", getCtrNameInPod(pod)}) + logs.WaitWithDefaultTimeout() + Expect(logs).Should(Exit(0)) + Expect(logs.OutputToString()).To(Equal(netns)) }) It("podman play kube persistentVolumeClaim", func() { diff --git a/test/system/700-play.bats b/test/system/700-play.bats index 8af4cd25b..b0624cbf2 100644 --- a/test/system/700-play.bats +++ b/test/system/700-play.bats @@ -233,3 +233,48 @@ _EOF run_podman stop -a -t 0 run_podman pod rm -t 0 -f test_pod } + +@test "podman play --annotation > Max" { + TESTDIR=$PODMAN_TMPDIR/testdir + RANDOMSTRING=$(random_string 65) + mkdir -p $TESTDIR + echo "$testYaml" | sed "s|TESTDIR|${TESTDIR}|g" > $PODMAN_TMPDIR/test.yaml + run_podman 125 play kube --annotation "name=$RANDOMSTRING" $PODMAN_TMPDIR/test.yaml + assert "$output" =~ "annotation exceeds maximum size, 63, of kubernetes annotation:" "Expected to fail with Length greater than 63" +} + +@test "podman play Yaml with annotation > Max" { + RANDOMSTRING=$(random_string 65) + testBadYaml=" +apiVersion: v1 +kind: Pod +metadata: + annotations: + test: ${RANDOMSTRING} + labels: + app: test + name: test_pod +spec: + containers: + - command: + - id + env: + - name: PATH + value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + - name: TERM + value: xterm + - name: container + + value: podman + image: quay.io/libpod/userimage + name: test + resources: {} +status: {} +" + TESTDIR=$PODMAN_TMPDIR/testdir + mkdir -p $TESTDIR + echo "$testBadYaml" | sed "s|TESTDIR|${TESTDIR}|g" > $PODMAN_TMPDIR/test.yaml + + run_podman 125 play kube - < $PODMAN_TMPDIR/test.yaml + assert "$output" =~ "invalid annotation \"test\"=\"$RANDOMSTRING\"" "Expected to fail with annotation length greater than 63" +} |