What does the timeout flag in go test represent

When I run multiple tests by running something like:
go test -timeout 30m ./TestOne ./TestTwo

Does that mean the timeout is 30m for each test.

The documentation states:
-timeout d If a test binary runs longer than duration d, panic. If d is 0, the timeout is disabled. The default is 10 minutes (10m).

My understanding is it is timeout per test.

The ‘test binary’ is

the result of ‘go test -c’

where -c is

-c
Compile the test binary to pkg.test but do not run it
(where pkg is the last element of the package’s import path).
The file name can be changed with the -o flag.

So the timeout is for all tests in this binary taken together.

1 Like

Thank you.