From f6fd787468979887acd5fcc0e9ddb3a409ebfdbd Mon Sep 17 00:00:00 2001 From: Artem Savkov Date: Thu, 22 Aug 2019 15:09:08 +0200 Subject: [PATCH] test/integration: add an ability to check specific repo/commit Add an ability to run vagrant integration tests on specified repos/commits. Signed-off-by: Artem Savkov --- test/integration/vm-integration-run | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/test/integration/vm-integration-run b/test/integration/vm-integration-run index f2eed81..133600e 100755 --- a/test/integration/vm-integration-run +++ b/test/integration/vm-integration-run @@ -1,16 +1,20 @@ #!/bin/bash KPATCH_SLOW=0 +KPATCH_GIT=${KPATCH_GIT:-https://github.com/dynup/kpatch.git} +KPATCH_REV=${KPATCH_REV:-HEAD} LOGDIR="/vagrant/logs" usage() { echo "usage: $(basename "${0}") [options]" >&2 - echo "-h, --help This message" >&2 - echo "-s, --slow Run all of the tests" >&2 + echo "-h, --help This message" >&2 + echo "-s, --slow Run all of the tests" >&2 + echo "-g, --git Git url to clone from" >&2 + echo "-r, --revision Revision to use (HEAD by default)" >&2 } -options="$(getopt -o s -l "slow" -- "$@")" || "getopt failed" +options="$(getopt -o "shg:r:" -l "slow,help,git:,revision:" -- "$@")" || "getopt failed" eval set -- "${options}" @@ -18,19 +22,33 @@ while [[ $# -gt 0 ]]; do case "$1" in -s|--slow) KPATCH_SLOW=1 + shift + ;; + -g|--git) + KPATCH_GIT="${2}" + shift 2 + ;; + -r|--revision) + KPATCH_REV="${2}" + shift 2 ;; -h|--help) usage exit 0 ;; + --) + shift + break + ;; esac - shift done -git clone https://github.com/dynup/kpatch.git || exit 1 +git clone "${KPATCH_GIT}" || exit 1 cd kpatch || exit 1 +git reset --hard "${KPATCH_REV}" || exit 1 + # shellcheck disable=SC1091 source test/integration/lib.sh