Skip to content

Commit

Permalink
test: use -json to prevent output buffering
Browse files Browse the repository at this point in the history
When testing multiple packages, "go test" buffers all the output until the tests finish, even with verbose (-v) mode. This is because parallel tests could otherwise interleave their output and be difficult to read. Across packages, tests could have the same name.

In JSON mode (-json), there's an explicit "Package" field in the output, so "go test" can safely print output as it comes in.

This ensures that if the tests are running for a long time due to server errors, the user can see the output as it comes in. Otherwise, Jenkins may terminate the job at the configured 40m deadline, before any meaningful output is printed.

golang/go#46959

Change-Id: Ia6e0bf92e927b14f56e601839b27141bb6dd1298
  • Loading branch information
bendrucker committed Dec 6, 2022
1 parent 9183aa9 commit 465d23e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ test: fmtcheck
xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4

testacc: fmtcheck
TF_ACC_TERRAFORM_CACHE_DIR=/tmp TF_ACC_TERRAFORM_VERSION=1.1.7 TF_LOG=DEBUG TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 120m
TF_ACC_TERRAFORM_CACHE_DIR=/tmp TF_ACC_TERRAFORM_VERSION=1.1.7 TF_LOG=DEBUG TF_ACC=1 go test $(TEST) -v -json $(TESTARGS) -timeout 120m

vet:
@echo "go vet ."
Expand Down

0 comments on commit 465d23e

Please sign in to comment.