diff --git a/test.sh b/test.sh index 9e5e1c6ea56..eec9b72d93f 100755 --- a/test.sh +++ b/test.sh @@ -17,6 +17,7 @@ STATUS="FAILURE" RUN=() UNIT_PACKAGES=() UNIT_FLAGS=() +INTEGRATION_FLAGS=() FILTER=() # @@ -39,11 +40,6 @@ function print_outcome() { fi } -function print_list_of_integration_tests() { - go test -tags integration -list=. ./test/integration/... | grep '^Test' - exit 0 -} - function exit_msg() { # complain to STDERR and exit with error echo "$*" >&2 @@ -101,7 +97,7 @@ With no options passed, runs standard battery of tests (lint, unit, and integrat -l, --lints Adds lint to the list of tests to run -u, --unit Adds unit to the list of tests to run - -v, --unit-verbose Enables verbose output for unit tests + -v, --verbose Enables verbose output for unit and integration tests -w, --unit-without-cache Disables go test caching for unit tests -p , --unit-test-package= Run unit tests for specific go package(s) -e, --enable-race-detection Enables race detection for unit and integration tests @@ -109,7 +105,6 @@ With no options passed, runs standard battery of tests (lint, unit, and integrat -i, --integration Adds integration to the list of tests to run -s, --start-py Adds start to the list of tests to run -g, --generate Adds generate to the list of tests to run - -o, --list-integration-tests Outputs a list of the available integration tests -f , --filter= Run only those tests matching the regular expression Note: @@ -125,7 +120,7 @@ With no options passed, runs standard battery of tests (lint, unit, and integrat EOM )" -while getopts luvweciosmgnhp:f:-: OPT; do +while getopts luvwecismgnhp:f:-: OPT; do if [ "$OPT" = - ]; then # long option: reformulate OPT and OPTARG OPT="${OPTARG%%=*}" # extract long option name OPTARG="${OPTARG#$OPT}" # extract long option argument (may be empty) @@ -134,12 +129,11 @@ while getopts luvweciosmgnhp:f:-: OPT; do case "$OPT" in l | lints ) RUN+=("lints") ;; u | unit ) RUN+=("unit") ;; - v | unit-verbose ) UNIT_FLAGS+=("-v") ;; + v | verbose ) UNIT_FLAGS+=("-v"); INTEGRATION_FLAGS+=("-v") ;; w | unit-without-cache ) UNIT_FLAGS+=("-count=1") ;; p | unit-test-package ) check_arg; UNIT_PACKAGES+=("${OPTARG}") ;; e | enable-race-detection ) RACE="true"; UNIT_FLAGS+=("-race") ;; i | integration ) RUN+=("integration") ;; - o | list-integration-tests ) print_list_of_integration_tests ;; f | filter ) check_arg; FILTER+=("${OPTARG}") ;; s | start-py ) RUN+=("start") ;; g | generate ) RUN+=("generate") ;; @@ -244,7 +238,11 @@ STAGE="integration" if [[ "${RUN[@]}" =~ "$STAGE" ]] ; then print_heading "Running Integration Tests" flush_redis - python3 test/integration-test.py --chisel --gotest "${FILTER[@]}" + if [[ "${INTEGRATION_FLAGS[@]}" =~ "-v" ]] ; then + python3 test/integration-test.py --chisel --gotestverbose "${FILTER[@]}" + else + python3 test/integration-test.py --chisel --gotest "${FILTER[@]}" + fi fi # Test that just ./start.py works, which is a proxy for testing that diff --git a/test/integration-test.py b/test/integration-test.py index af4aa386051..18b0452e998 100644 --- a/test/integration-test.py +++ b/test/integration-test.py @@ -34,7 +34,7 @@ if os.environ.get('RACE', 'true') != 'true': race_detection = False -def run_go_tests(filterPattern=None): +def run_go_tests(filterPattern=None,verbose=False): """ run_go_tests launches the Go integration tests. The go test command must return zero or an exception will be raised. If the filterPattern is provided @@ -43,7 +43,10 @@ def run_go_tests(filterPattern=None): cmdLine = ["go", "test"] if filterPattern is not None and filterPattern != "": cmdLine = cmdLine + ["--test.run", filterPattern] - cmdLine = cmdLine + ["-tags", "integration", "-count=1", "-race", "./test/integration"] + cmdLine = cmdLine + ["-tags", "integration", "-count=1", "-race"] + if verbose: + cmdLine = cmdLine + ["-v"] + cmdLine = cmdLine + ["./test/integration"] subprocess.check_call(cmdLine, stderr=subprocess.STDOUT) exit_status = 1 @@ -54,6 +57,8 @@ def main(): help="run integration tests using chisel") parser.add_argument('--gotest', dest="run_go", action="store_true", help="run Go integration tests") + parser.add_argument('--gotestverbose', dest="run_go_verbose", action="store_true", + help="run Go integration tests with verbose output") parser.add_argument('--filter', dest="test_case_filter", action="store", help="Regex filter for test cases") # allow any ACME client to run custom command for integration @@ -90,7 +95,10 @@ def main(): run_chisel(args.test_case_filter) if args.run_go: - run_go_tests(args.test_case_filter) + run_go_tests(args.test_case_filter, False) + + if args.run_go_verbose: + run_go_tests(args.test_case_filter, True) if args.custom: run(args.custom.split())