The logs did not stream to stdout, but were batched until each test completed.
When I run the tests for a single package (go test -v ./pkg1), or if I run the tests without package parallelism (go test -p 1 -v ./...), the logs do stream.
It looks to me like this is probably behaving as intended, especially since Go 1.14 had this same behavior, but the release notes are misleading since they simply state that logs stream but not that they only stream under specific conditions.
I haven't found documentation about the interactions between log streaming and test package parallelism. I haven't found any documentation about test package parallelism either, and the help pages inside the go tool itself about the -p flag are difficult to find. To find a definition of it, one has to follow two references, so the path to discovering it is go help test, then go help testflags, then go help build.
Possibly this is an opportunity for improved docs, but it's unclear to me where that would need to go.
The text was updated successfully, but these errors were encountered:
It talks about the difference between running go test without and with package arguments. Initially, I was going to reply to this issue saying that only in the mode without arguments you were meant to get streaming output, but that's clearly wrong - like you say, go test -v ./pkg streams output too.
It would be nice to override this behavior or detect that I'm only running tests from a single package and stream. In my use cases, I'm only running some specific tests via go test -v -run TestImportHistoricalMessages ./tests/... which are all in a single file (let alone the same package) but the directory,./tests/..., happens to include multiple packages.
As a workaround, I can get the log streaming behavior I want by being very selective about the files to run: go test -v -run TestImportHistoricalMessages ./tests/main_test.go ./tests/msc2716_test.go but this is manual process adjusting our generic test runner every time.
Created #49195 to track a solution for this similar use case.