Skip to content

Commit 6692160

Browse files
test-cli: Pass -v/--verbose flag to Go integration tests (#7754)
Also remove -o/--list-integration-tests, this flag isn't really that useful.
1 parent b0bcbb1 commit 6692160

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

test.sh

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ STATUS="FAILURE"
1717
RUN=()
1818
UNIT_PACKAGES=()
1919
UNIT_FLAGS=()
20+
INTEGRATION_FLAGS=()
2021
FILTER=()
2122

2223
#
@@ -39,11 +40,6 @@ function print_outcome() {
3940
fi
4041
}
4142

42-
function print_list_of_integration_tests() {
43-
go test -tags integration -list=. ./test/integration/... | grep '^Test'
44-
exit 0
45-
}
46-
4743
function exit_msg() {
4844
# complain to STDERR and exit with error
4945
echo "$*" >&2
@@ -101,15 +97,14 @@ With no options passed, runs standard battery of tests (lint, unit, and integrat
10197
10298
-l, --lints Adds lint to the list of tests to run
10399
-u, --unit Adds unit to the list of tests to run
104-
-v, --unit-verbose Enables verbose output for unit tests
100+
-v, --verbose Enables verbose output for unit and integration tests
105101
-w, --unit-without-cache Disables go test caching for unit tests
106102
-p <DIR>, --unit-test-package=<DIR> Run unit tests for specific go package(s)
107103
-e, --enable-race-detection Enables race detection for unit and integration tests
108104
-n, --config-next Changes BOULDER_CONFIG_DIR from test/config to test/config-next
109105
-i, --integration Adds integration to the list of tests to run
110106
-s, --start-py Adds start to the list of tests to run
111107
-g, --generate Adds generate to the list of tests to run
112-
-o, --list-integration-tests Outputs a list of the available integration tests
113108
-f <REGEX>, --filter=<REGEX> Run only those tests matching the regular expression
114109
115110
Note:
@@ -125,7 +120,7 @@ With no options passed, runs standard battery of tests (lint, unit, and integrat
125120
EOM
126121
)"
127122

128-
while getopts luvweciosmgnhp:f:-: OPT; do
123+
while getopts luvwecismgnhp:f:-: OPT; do
129124
if [ "$OPT" = - ]; then # long option: reformulate OPT and OPTARG
130125
OPT="${OPTARG%%=*}" # extract long option name
131126
OPTARG="${OPTARG#$OPT}" # extract long option argument (may be empty)
@@ -134,12 +129,11 @@ while getopts luvweciosmgnhp:f:-: OPT; do
134129
case "$OPT" in
135130
l | lints ) RUN+=("lints") ;;
136131
u | unit ) RUN+=("unit") ;;
137-
v | unit-verbose ) UNIT_FLAGS+=("-v") ;;
132+
v | verbose ) UNIT_FLAGS+=("-v"); INTEGRATION_FLAGS+=("-v") ;;
138133
w | unit-without-cache ) UNIT_FLAGS+=("-count=1") ;;
139134
p | unit-test-package ) check_arg; UNIT_PACKAGES+=("${OPTARG}") ;;
140135
e | enable-race-detection ) RACE="true"; UNIT_FLAGS+=("-race") ;;
141136
i | integration ) RUN+=("integration") ;;
142-
o | list-integration-tests ) print_list_of_integration_tests ;;
143137
f | filter ) check_arg; FILTER+=("${OPTARG}") ;;
144138
s | start-py ) RUN+=("start") ;;
145139
g | generate ) RUN+=("generate") ;;
@@ -244,7 +238,11 @@ STAGE="integration"
244238
if [[ "${RUN[@]}" =~ "$STAGE" ]] ; then
245239
print_heading "Running Integration Tests"
246240
flush_redis
247-
python3 test/integration-test.py --chisel --gotest "${FILTER[@]}"
241+
if [[ "${INTEGRATION_FLAGS[@]}" =~ "-v" ]] ; then
242+
python3 test/integration-test.py --chisel --gotestverbose "${FILTER[@]}"
243+
else
244+
python3 test/integration-test.py --chisel --gotest "${FILTER[@]}"
245+
fi
248246
fi
249247

250248
# Test that just ./start.py works, which is a proxy for testing that

test/integration-test.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
if os.environ.get('RACE', 'true') != 'true':
3535
race_detection = False
3636

37-
def run_go_tests(filterPattern=None):
37+
def run_go_tests(filterPattern=None,verbose=False):
3838
"""
3939
run_go_tests launches the Go integration tests. The go test command must
4040
return zero or an exception will be raised. If the filterPattern is provided
@@ -43,7 +43,10 @@ def run_go_tests(filterPattern=None):
4343
cmdLine = ["go", "test"]
4444
if filterPattern is not None and filterPattern != "":
4545
cmdLine = cmdLine + ["--test.run", filterPattern]
46-
cmdLine = cmdLine + ["-tags", "integration", "-count=1", "-race", "./test/integration"]
46+
cmdLine = cmdLine + ["-tags", "integration", "-count=1", "-race"]
47+
if verbose:
48+
cmdLine = cmdLine + ["-v"]
49+
cmdLine = cmdLine + ["./test/integration"]
4750
subprocess.check_call(cmdLine, stderr=subprocess.STDOUT)
4851

4952
exit_status = 1
@@ -54,6 +57,8 @@ def main():
5457
help="run integration tests using chisel")
5558
parser.add_argument('--gotest', dest="run_go", action="store_true",
5659
help="run Go integration tests")
60+
parser.add_argument('--gotestverbose', dest="run_go_verbose", action="store_true",
61+
help="run Go integration tests with verbose output")
5762
parser.add_argument('--filter', dest="test_case_filter", action="store",
5863
help="Regex filter for test cases")
5964
# allow any ACME client to run custom command for integration
@@ -90,7 +95,10 @@ def main():
9095
run_chisel(args.test_case_filter)
9196

9297
if args.run_go:
93-
run_go_tests(args.test_case_filter)
98+
run_go_tests(args.test_case_filter, False)
99+
100+
if args.run_go_verbose:
101+
run_go_tests(args.test_case_filter, True)
94102

95103
if args.custom:
96104
run(args.custom.split())

0 commit comments

Comments
 (0)