diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-03-07 15:23:54 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-07 15:23:54 -0800 |
commit | 1b2f8679b864b882fdccaad6fdd6a5c86c83291b (patch) | |
tree | e131eaf7fbecf6c36ca6f21468cef6bd8ebac4cd /test/system/030-run.bats | |
parent | e0f224816d41ccf353bccd9ef6933a201cdc7d64 (diff) | |
parent | 589248d2f359dea73fc763ac587e2927f005b300 (diff) | |
download | podman-1b2f8679b864b882fdccaad6fdd6a5c86c83291b.tar.gz podman-1b2f8679b864b882fdccaad6fdd6a5c86c83291b.tar.bz2 podman-1b2f8679b864b882fdccaad6fdd6a5c86c83291b.zip |
Merge pull request #2533 from edsantiago/bats
New system tests under BATS
Diffstat (limited to 'test/system/030-run.bats')
-rw-r--r-- | test/system/030-run.bats | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/system/030-run.bats b/test/system/030-run.bats new file mode 100644 index 000000000..8ae68f33d --- /dev/null +++ b/test/system/030-run.bats @@ -0,0 +1,34 @@ +#!/usr/bin/env bats + +load helpers + +@test "podman run - basic tests" { + rand=$(random_string 30) + tests=" +true | 0 | +false | 1 | +sh -c 'exit 32' | 32 | +echo $rand | 0 | $rand +/no/such/command | 127 | Error: container create failed:.*exec:.* no such file or dir +/etc | 126 | Error: container create failed:.*exec:.* permission denied +" + + while read cmd expected_rc expected_output; do + if [ "$expected_output" = "''" ]; then expected_output=""; fi + + # THIS IS TRICKY: this is what lets us handle a quoted command. + # Without this incantation (and the "$@" below), the cmd string + # gets passed on as individual tokens: eg "sh" "-c" "'exit" "32'" + # (note unmatched opening and closing single-quotes in the last 2). + # That results in a bizarre and hard-to-understand failure + # in the BATS 'run' invocation. + # This should really be done inside parse_table; I can't find + # a way to do so. + eval set "$cmd" + + run_podman $expected_rc run $IMAGE "$@" + is "$output" "$expected_output" "podman run $cmd - output" + done < <(parse_table "$tests") +} + +# vim: filetype=sh |