-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make running bash funciones more generic
We have too many duplicated bash scripts to run different ginkgo testsuites, so lets try to make a generic script to reduce code duplication.
- Loading branch information
1 parent
951cc09
commit 8c57eab
Showing
6 changed files
with
90 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#!/bin/bash | ||
|
||
readonly CURRENT_SCRIPT=$(basename $0) | ||
|
||
HEADER_MESSAGE="Running Tests " | ||
|
||
usage() { | ||
print "Usage:" | ||
print " ${CURRENT_SCRIPT} [-h] -s suites -p extraparams [-m header_message]" | ||
print "" | ||
print "Options:" | ||
print " -h Help for ${CURRENT_SCRIPT}" | ||
print " -t list of space separated paths to Testsuites to execute" | ||
print " -p string with extra Params for ginkgo" | ||
print " -m Message header to print before test execution. Default '${HEADER_MESSAGE}'" | ||
} | ||
|
||
exit_error() { | ||
print "" | ||
print "error: $*" | ||
exit 1 | ||
} | ||
|
||
print() { | ||
echo "$*" >&2 | ||
} | ||
|
||
HEADER_MESSAGE="Running Tests " | ||
|
||
main() { | ||
while getopts ':ht:p:m:' OPT; do | ||
case "$OPT" in | ||
h) | ||
usage | ||
exit 0 | ||
;; | ||
t) | ||
GINKGO_SUITS="${OPTARG}" | ||
;; | ||
p) | ||
EXTRA_PARAMS="${OPTARG}" | ||
;; | ||
m) | ||
HEADER_MESSAGE="${OPTARG}" | ||
;; | ||
?) | ||
usage | ||
exit_error "invalid argument: ${OPTARG}" | ||
;; | ||
esac | ||
done | ||
shift $((OPTIND - 1)) | ||
|
||
if [ -z "$GINKGO_SUITS" ] || [ -z "$EXTRA_PARAMS" ]; then | ||
usage | ||
exit_error "Missing arguments -t or -p" | ||
fi | ||
|
||
LATENCY_TEST_RUN=${LATENCY_TEST_RUN:-"false"} | ||
|
||
which ginkgo | ||
if [ $? -ne 0 ]; then | ||
echo "Downloading ginkgo tool" | ||
go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo@v2.6.1 | ||
ginkgo version | ||
fi | ||
|
||
NO_COLOR="" | ||
if ! which tput &>/dev/null 2>&1 || [[ $(tput -T$TERM colors) -lt 8 ]]; then | ||
echo "Terminal does not seem to support colored output, disabling it" | ||
NO_COLOR="-noColor" | ||
fi | ||
|
||
# run the latency tests under the OpenShift CI, just to verify that the image works | ||
if [ -n "${IMAGE_FORMAT}" ]; then | ||
LATENCY_TEST_RUN="true" | ||
fi | ||
|
||
MESSAGE="${HEADER_MESSAGE}: ${GINKGO_SUITS}" | ||
print ${MESSAGE} | ||
|
||
GINKGO_FLAGS="${NO_COLOR} ${EXTRA_PARAMS} --require-suite ${GINKGO_SUITS}" | ||
GOFLAGS=-mod=vendor ginkgo ${GINKGO_FLAGS} | ||
} | ||
|
||
main "$@" |
This file was deleted.
Oops, something went wrong.