Skip to content

Commit

Permalink
Add new command option.
Browse files Browse the repository at this point in the history
Just an option to see the ginkgo command line without actually executing it
  • Loading branch information
jlojosnegros committed May 31, 2023
1 parent 08870f3 commit b887b73
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions hack/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ HEADER_MESSAGE="Running Tests "

usage() {
print "Usage:"
print " ${CURRENT_SCRIPT} [-h] [-d] -s suites -p extraparams [-m header_message]"
print " ${CURRENT_SCRIPT} [-h] [-c] [-d] -s suites -p extraparams [-m header_message]"
print ""
print "Options:"
print " -h Help for ${CURRENT_SCRIPT}"
Expand All @@ -15,6 +15,7 @@ usage() {
print " -r string with report Params for ginkgo (these params will go after the list of suites)"
print " -m Message header to print before test execution. Default '${HEADER_MESSAGE}'"
print " -d Ginkgo dry-run. Will output all ginkgo test without execute them, letting you know the actual tests to be executed with the given parameters"
print " -c Command line print. This will just print ginkgo command line to be execting without actually executing it."
}

exit_error() {
Expand All @@ -28,10 +29,11 @@ print() {
}

HEADER_MESSAGE="Running Tests "
ONLY_CLI_PRINT=false
DRY_RUN=""

main() {
while getopts ':h:dt:p:m:r:' OPT; do
while getopts ':h:c:dt:p:m:r:' OPT; do
case "$OPT" in
h)
usage
Expand All @@ -52,6 +54,9 @@ main() {
d)
DRY_RUN="--dry-run"
;;
c)
ONLY_CLI_PRINT=true
;;
?)
usage
exit_error "invalid argument: ${OPTARG}"
Expand Down Expand Up @@ -90,7 +95,13 @@ main() {

GINKGO_FLAGS="${NO_COLOR} ${DRY_RUN} ${EXTRA_PARAMS} --require-suite ${GINKGO_SUITS} ${REPORT_PARAMS}"
print "Command to run: GOFLAGS=-mod=vendor ginkgo ${GINKGO_FLAGS}"
GOFLAGS=-mod=vendor ginkgo ${GINKGO_FLAGS}

if [ "$ONLY_CLI_PRINT" = true ]; then
print "Skipping execution as requested by user ... "
else
print "Executing test suites ... "
GOFLAGS=-mod=vendor ginkgo ${GINKGO_FLAGS}
fi
}

main "$@"

0 comments on commit b887b73

Please sign in to comment.