OpenResty::Spec::TestSuite - Introduction to the OpenResty test suite
$ make test -f dev.mk # OR $ prove -Ilib -r t
OpenResty comes with a relatively big test suite.
Most of the test suite is organized by the Test::Base. The main test scaffold is in the t/OpenResty.pm file.
There's various different ways to run the suite.
The backend.type option in the config file (i.e., etc/site_openresty.conf) determines which backend the server is using. Possible values are Pg, PgFarm, and PgMocked. The default value is PgMocked, which is a mocked-up version of the Pg backend, so that users without a proper Pg setup (like CPAN testers) can still run the whole test suite. Please see OpenResty::Backend::PgMocked for more information.
backend.type
Pg
PgFarm
PgMocked
The test_suite.use_http option in the config file determines whether or not the test scaffold should use HTTP to test the server. When it is set to 1, the test harness will use LWP::UserAgent to test the server specified by the test_suite.server and test_suite.server2 options. If set to 0, the test suite will run directly in the same process of the OpenResty server by using a mocked-up CGI environment provided by WWW::OpenResty::Embedded.
test_suite.use_http
LWP::UserAgent
test_suite.server
test_suite.server2
Note that when test_suite.use_http is set to 1, it's possible to test a remote OpenResty server.
Agent Zhang (agentzh) <agentzh@yahoo.cn>
<agentzh@yahoo.cn>
OpenResty.
To install OpenResty, copy and paste the appropriate command in to your terminal.
cpanm
cpanm OpenResty
CPAN shell
perl -MCPAN -e shell install OpenResty
For more information on module installation, please visit the detailed CPAN module installation guide.