Hello!
2016-08-05 0:54 GMT-07:00 Celebi:
> 谢谢,我不写perl的,所以之前没想过看cpan上的这个文档,确实是不错的文档。
>
> 但我看过文档之后,如果我要用这种方法实现我的目的,我需要手动(或者写个工具)将现有的nginx.conf拆开,然后写到不同的section中去。还是有点麻烦。
或许你可以用 nginx 的 include 指令来加载核心的 nginx 配置?比如
=== TEST 1: App
--- config
include ../../../conf/app-core.conf;
--- request
GET /t
--- response_body
hello world
--- no_error_log
[error]
假设你的项目目录结构是这样的:
t/
└── a.t
conf/
└── app-core.conf
nginx.conf 的 boilter-plate 由 Test::Nginx 来自动生成是必要的,否则我们无法实现这里列举的
Test::Nginx 的各种高级测试模式:
https://openresty.gitbooks.io/programming-openresty/content/testing/test-modes.html
Regards,
-agentzh