测试因运行时间过长而被终止。

huangapple go评论67阅读模式
英文:

Test killed with quit: ran too long

问题

我运行了go test,并得到了超时错误:

*** 测试被终止:运行时间过长(10分钟)。
FAIL	call/httptest	600.050秒

如何延长超时时间,使其大于10分钟?

英文:

I run go test and got timout error:

*** Test killed with quit: ran too long (10m0s).
FAIL	call/httptest	600.050s

How to extend timeout and make it bigger than 10 minutes?

答案1

得分: 36

使用go test -timeout <duration>命令,例如:

$ go test -timeout 20m

默认超时时间为10分钟。

文档中可以得知:

有效的时间单位包括"ns"(纳秒)、"us"(微秒或μs)、"ms"(毫秒)、"s"(秒)、"m"(分钟)、"h"(小时)。

英文:

Use go test -timeout &lt;duration&gt;, e.g.:

$ go test -timeout 20m

The default is 10m.

From the docs:

> Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".

答案2

得分: 3

默认情况下,超时时间为10分钟后退出。

go test --help

	    如果测试二进制文件运行时间超过d,就会引发panic。
	    如果d为0,则禁用超时。
	    默认值为10分钟(10m)。
英文:

By default, timeout exit after 10 minutes

go test --help

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

huangapple
  • 本文由 发表于 2015年1月5日 19:09:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/27778280.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定