no_error_log
断言错误日志中不包含指定的内容。
语法
--- no_error_log 段确保错误日志中不包含指定的字符串。这是确保没有意外错误的最常用方式。
perl
1=== TEST 1: no errors2--- config3 location /t {4 echo "ok";5 }6--- request7GET /t8--- response_body9ok10--- no_error_log11[error]12[alert]13[emerg]推荐在每个测试块中都加上 --- no_error_log\n[error] 来捕获意外错误。这是 OpenResty 项目中的最佳实践。