diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-02-10 10:30:39 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-10 10:30:39 -0500 |
commit | 832639ca6d1d8004c46aaa4e6c021dfd5a314af3 (patch) | |
tree | 41745ffaca61837925e040aae77daecc6023cd90 /test | |
parent | 939282fe9182fcbf1a2a41cddcb0d039f69ca0be (diff) | |
parent | 1cc387bf780d47a65bc82519e449cfbead70a015 (diff) | |
download | podman-832639ca6d1d8004c46aaa4e6c021dfd5a314af3.tar.gz podman-832639ca6d1d8004c46aaa4e6c021dfd5a314af3.tar.bz2 podman-832639ca6d1d8004c46aaa4e6c021dfd5a314af3.zip |
Merge pull request #9299 from Luap99/secret-shell-completion-test
Add shell completion tests for secrets
Diffstat (limited to 'test')
-rw-r--r-- | test/system/600-completion.bats | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/test/system/600-completion.bats b/test/system/600-completion.bats index 8cac2c9aa..fbb0da231 100644 --- a/test/system/600-completion.bats +++ b/test/system/600-completion.bats @@ -157,7 +157,17 @@ function check_shell_completion() { # resume ;;& - *PATH* | *CONTEXT* | *KUBEFILE* | *COMMAND* | *ARG...* | *URI*) + *SECRET*) + run_completion "$@" $cmd "${extra_args[@]}" "" + is "$output" ".*$random_secret_name${nl}" \ + "$* $cmd: actual secret listed in suggestions" + _check_completion_end NoFileComp + + match=true + # resume + ;;& + + *PATH* | *CONTEXT* | *FILE* | *COMMAND* | *ARG...* | *URI*) # default shell completion should be done for everything which accepts a path run_completion "$@" $cmd "${extra_args[@]}" "" @@ -232,6 +242,11 @@ function _check_completion_end() { random_image_tag=$(random_string 5) random_network_name=$(random_string 30) random_volume_name=$(random_string 30) + random_secret_name=$(random_string 30) + random_secret_content=$(random_string 30) + secret_file=$PODMAN_TMPDIR/$(random_string 10) + + echo $random_secret_content > $secret_file # create a container for each state since some commands are only suggesting running container for example run_podman create --name created-$random_container_name $IMAGE @@ -263,6 +278,8 @@ function _check_completion_end() { # create volume run_podman volume create $random_volume_name + # create secret + run_podman secret create $random_secret_name $secret_file # $PODMAN may be a space-separated string, e.g. if we include a --url. local -a podman_as_array=($PODMAN) @@ -274,6 +291,9 @@ function _check_completion_end() { check_shell_completion # cleanup + run_podman secret rm $random_secret_name + rm -f $secret_file + run_podman volume rm $random_volume_name run_podman network rm $random_network_name |