我运行go test
并出现超时错误:
*** Test killed with quit: ran too long (10m0s).
FAIL call/httptest 600.050s
如何延长超时并使其超过10分钟?
答案 0 :(得分:19)
使用go test -timeout <duration>
,例如:
$ go test -timeout 20m
来自the docs:
有效时间单位为“ns”,“us”(或“μs”),“ms”,“s”,“m”,“h”。
答案 1 :(得分:1)
默认情况下,10分钟后超时退出
go test --help
-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).