Skip to content

Commit 35508f3

Browse files
author
ag
committed
unit test coverage respects UNIT_PACKAGES, other minor fixes
1 parent 20ee27f commit 35508f3

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

test.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,11 @@ if [[ "${RUN[@]}" =~ "$STAGE" ]] ; then
239239
print_heading "Running Unit Tests"
240240
flush_redis
241241

242-
if [ "$COVERAGE" == "true" ]; then
243-
export GOFLAGS="-cover -covermode=atomic -coverprofile=${COVERAGE_DIR}/unit.coverprofile -coverpkg=./..."
242+
if [ "${COVERAGE}" == "true" ]; then
243+
UNIT_CSV=$(IFS=,; echo "${UNIT_PACKAGES[*]}")
244+
UNIT_FLAGS+=("-cover" "-covermode=atomic" "-coverprofile=${COVERAGE_DIR}/unit.coverprofile" "-coverpkg=${UNIT_CSV}")
244245
fi
246+
245247
run_unit_tests
246248
fi
247249

@@ -265,7 +267,6 @@ if [[ "${RUN[@]}" =~ "$STAGE" ]] ; then
265267

266268
# Add coverage settings if enabled
267269
if [ "${COVERAGE}" == "true" ]; then
268-
# export GOFLAGS="-cover -covermode=atomic -coverprofile=${COVERAGE_DIR}/integration.coverprofile -coverpkg=./..."
269270
INTEGRATION_ARGS+=("--coverage" "--coverage-dir=${COVERAGE_DIR}")
270271
fi
271272

test/integration-test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def process_covdata(coverage_dir):
173173
cov_text = os.path.join(coverage_dir, "integration.coverprofile")
174174
# this works, but if it takes a long time consider merging with `go tool covdata merge` first
175175
# https://go.dev/blog/integration-test-coverage#merging-raw-profiles-with-go-tool-covdata-merge
176-
subprocess.check_call(["go", "tool", "covdata", "textfmt", "-i", coverage_dir, "-o", cov_text])
176+
run(["go", "tool", "covdata", "textfmt", "-i", coverage_dir, "-o", cov_text])
177177

178178
if __name__ == "__main__":
179179
main()

0 commit comments

Comments
 (0)