Switch to entrypoint to allow running one-off tests easily. Fix and expand cli options

This commit is contained in:
Andrew Mason 2020-07-06 18:48:06 -04:00
parent c4464bfcf1
commit a1eb535bee
2 changed files with 8 additions and 3 deletions

View File

@ -30,4 +30,4 @@ ADD itest.sh /itest.sh
ADD bin/gh-ost /usr/local/bin/gh-ost ADD bin/gh-ost /usr/local/bin/gh-ost
ADD localtests /localtests ADD localtests /localtests
CMD ["/itest.sh"] ENTRYPOINT ["/itest.sh", "-b", "/usr/local/bin/gh-ost"]

View File

@ -4,6 +4,7 @@
#/ #/
#/ Options: #/ Options:
#/ --gh-ost-binary | -b path to gh-ost binary. defaults to /tmp/gh-ost-test #/ --gh-ost-binary | -b path to gh-ost binary. defaults to /tmp/gh-ost-test
#/ --test-dir path to test directories. defaults to /localtests
usage() { usage() {
code="$1" code="$1"
@ -13,15 +14,19 @@ usage() {
exit "$code" exit "$code"
} }
GHOST_BINARY= GHOST_BINARY=/tmp/gh-ost-test
TEST_DIR=/localtests
while [ "$#" -gt 0 ]; while [ "$#" -gt 0 ];
do do
case "$1" in case "$1" in
--gh-ost-binary|-b) GHOST_BINARY="$2"; shift 2;; --gh-ost-binary|-b) GHOST_BINARY="$2"; shift 2;;
--gh-ost-binary=*) GHOST_BINARY="$(echo "$1" | cut -d"=" -f"2-")"; shift;; --gh-ost-binary=*) GHOST_BINARY="$(echo "$1" | cut -d"=" -f"2-")"; shift;;
--test-dir) TEST_DIR="$2"; shift 2;;
--test-dir=*) TEST_DIR="$(echo "$1" | cut -d"=" -f"2-")"; shift;;
--help|-h) usage 0;; --help|-h) usage 0;;
-*) usage 1;; -*) usage 1;;
*) ;; *) break ;;
esac esac
done done