Fix make test targets when empty bash args provided

Signed-off-by: Shyam Jeedigunta <jeedigv@amazon.com>
This commit is contained in:
Shyam Jeedigunta 2023-08-17 14:03:07 -07:00
parent 39aad38f02
commit 83f20f61cb

View File

@ -103,8 +103,8 @@ function build_pass {
function run_unit_tests { function run_unit_tests {
local pkgs="${1:-./...}" local pkgs="${1:-./...}"
shift 1 shift 1
# shellcheck disable=SC2086 # shellcheck disable=SC2068 #For context see - https://github.com/etcd-io/etcd/pull/16433#issuecomment-1684312755
GOLANG_TEST_SHORT=true go_test "${pkgs}" "parallel" : -short -timeout="${TIMEOUT:-3m}" "${COMMON_TEST_FLAGS[@]}" "${RUN_ARG[@]}" "$@" GOLANG_TEST_SHORT=true go_test "${pkgs}" "parallel" : -short -timeout="${TIMEOUT:-3m}" ${COMMON_TEST_FLAGS[@]:-} ${RUN_ARG[@]:-} "$@"
} }
function unit_pass { function unit_pass {
@ -113,27 +113,33 @@ function unit_pass {
function integration_extra { function integration_extra {
if [ -z "${PKG}" ] ; then if [ -z "${PKG}" ] ; then
run_for_module "tests" go_test "./integration/v2store/..." "keep_going" : -timeout="${TIMEOUT:-5m}" "${RUN_ARG[@]}" "${COMMON_TEST_FLAGS[@]}" "$@" || return $? # shellcheck disable=SC2068
run_for_module "tests" go_test "./integration/v2store/..." "keep_going" : -timeout="${TIMEOUT:-5m}" ${COMMON_TEST_FLAGS[@]:-} ${RUN_ARG[@]:-} "$@" || return $?
else else
log_warning "integration_extra ignored when PKG is specified" log_warning "integration_extra ignored when PKG is specified"
fi fi
} }
function integration_pass { function integration_pass {
run_for_module "tests" go_test "./integration/..." "parallel" : -timeout="${TIMEOUT:-15m}" "${COMMON_TEST_FLAGS[@]}" "${RUN_ARG[@]}" -p=2 "$@" || return $? # shellcheck disable=SC2068
run_for_module "tests" go_test "./common/..." "parallel" : --tags=integration -timeout="${TIMEOUT:-15m}" "${COMMON_TEST_FLAGS[@]}" -p=2 "${RUN_ARG[@]}" "$@" || return $? run_for_module "tests" go_test "./integration/..." "parallel" : -timeout="${TIMEOUT:-15m}" ${COMMON_TEST_FLAGS[@]:-} ${RUN_ARG[@]:-} -p=2 "$@" || return $?
# shellcheck disable=SC2068
run_for_module "tests" go_test "./common/..." "parallel" : --tags=integration -timeout="${TIMEOUT:-15m}" ${COMMON_TEST_FLAGS[@]:-} ${RUN_ARG[@]:-} -p=2 "$@" || return $?
integration_extra "$@" integration_extra "$@"
} }
function e2e_pass { function e2e_pass {
# e2e tests are running pre-build binary. Settings like --race,-cover,-cpu does not have any impact. # e2e tests are running pre-build binary. Settings like --race,-cover,-cpu does not have any impact.
run_for_module "tests" go_test "./e2e/..." "keep_going" : -timeout="${TIMEOUT:-30m}" "${RUN_ARG[@]}" "$@" || return $? # shellcheck disable=SC2068
run_for_module "tests" go_test "./common/..." "keep_going" : --tags=e2e -timeout="${TIMEOUT:-30m}" "${RUN_ARG[@]}" "$@" run_for_module "tests" go_test "./e2e/..." "keep_going" : -timeout="${TIMEOUT:-30m}" ${RUN_ARG[@]:-} "$@" || return $?
# shellcheck disable=SC2068
run_for_module "tests" go_test "./common/..." "keep_going" : --tags=e2e -timeout="${TIMEOUT:-30m}" ${RUN_ARG[@]:-} "$@"
} }
function robustness_pass { function robustness_pass {
# e2e tests are running pre-build binary. Settings like --race,-cover,-cpu does not have any impact. # e2e tests are running pre-build binary. Settings like --race,-cover,-cpu does not have any impact.
run_for_module "tests" go_test "./robustness" "keep_going" : -timeout="${TIMEOUT:-30m}" "${RUN_ARG[@]}" "$@" # shellcheck disable=SC2068
run_for_module "tests" go_test "./robustness" "keep_going" : -timeout="${TIMEOUT:-30m}" ${RUN_ARG[@]:-} "$@"
} }
function integration_e2e_pass { function integration_e2e_pass {
@ -164,13 +170,13 @@ function grpcproxy_pass {
} }
function grpcproxy_integration_pass { function grpcproxy_integration_pass {
run_for_module "tests" go_test "./integration/..." "fail_fast" : \ # shellcheck disable=SC2068
-timeout=30m -tags cluster_proxy "${COMMON_TEST_FLAGS[@]}" "$@" run_for_module "tests" go_test "./integration/..." "fail_fast" : -timeout=30m -tags cluster_proxy ${COMMON_TEST_FLAGS[@]:-} "$@"
} }
function grpcproxy_e2e_pass { function grpcproxy_e2e_pass {
run_for_module "tests" go_test "./e2e" "fail_fast" : \ # shellcheck disable=SC2068
-timeout=30m -tags cluster_proxy "${COMMON_TEST_FLAGS[@]}" "$@" run_for_module "tests" go_test "./e2e" "fail_fast" : -timeout=30m -tags cluster_proxy ${COMMON_TEST_FLAGS[@]:-} "$@"
} }
################# COVERAGE ##################################################### ################# COVERAGE #####################################################