timeout
设置当前测试块的超时时间(秒)。
语法
--- timeout 段覆盖默认的测试超时时间。默认超时通常是 3 秒。对于需要较长处理时间的测试可以增大此值。
perl
1=== TEST 1: slow operation2--- timeout: 103--- config4 location /t {5 content_by_lua_block {6 ngx.sleep(2)7 ngx.say("done after sleep")8 }9 }10--- request11GET /t12--- response_body13done after sleep不要轻易增大超时时间。如果测试需要很长时间才能完成,通常意味着被测代码存在性能问题。