diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-04-27 09:42:31 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-27 09:42:31 -0400 |
commit | bbe419ef9ffda699aa87ab0fcb2bdf50c0ff5058 (patch) | |
tree | 85bf123d2a7e1c3439d7a2da9e4656eabfbf1fb7 /test | |
parent | c44efb011003942adedb6ac74457be0123d23a02 (diff) | |
parent | 7259a6315c7f7d97665d928de6357fc3cbcae136 (diff) | |
download | podman-bbe419ef9ffda699aa87ab0fcb2bdf50c0ff5058.tar.gz podman-bbe419ef9ffda699aa87ab0fcb2bdf50c0ff5058.tar.bz2 podman-bbe419ef9ffda699aa87ab0fcb2bdf50c0ff5058.zip |
Merge pull request #14023 from rhatdan/kube
Truncate annotations when generating kubernetes yaml files
Diffstat (limited to 'test')
-rw-r--r-- | test/system/700-play.bats | 45 |
1 files changed, 45 insertions, 0 deletions
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" +} |