[ANN] Test::Nginx 0.26 released

Yichun Zhang (agentzh) agentzh at gmail.com
Mon Apr 10 02:13:55 UTC 2017

Hi folks,

I've just uploaded Test::Nginx 0.26 to CPAN:


It will appear on the CPAN mirror near you in the next few hours or
so. After that, you can install the module like below

    sudo cpan Test::Nginx

or better, when you have the App::cpanminus module already installed:

    sudo cpanm Test::Nginx

The highlights of this release is

1. The test scaffold makes it possible to run the test suite in
multiple parallel jobs to utilize multiple CPU cores in the same
system when the environment TEST_NGINX_RANDOMIZE=1 is specified and
the -jN option is used in the prove command line (where N is an
integer equal to the number of jobs). For example,
ngx_http_echo_module and lua-resty-core's test suites can both run in
multiple parallel jobs, greatly reducing the overall testing time on a
multi-core system.

2. We now have the Test::Nginx::Socket::Lua::Dgram test class for
testing datagram nginx servers in a declarative way.

3. We now have the new `--- response_body_filters` section to
pre-process the *actual* response body received from the HTTP nginx
server before doing any comparisons. For example, one can use a custom
filter to calculate the MD5 checksum of a binary response body
actually received from the server and then compare the MD5 checksum
instead of the raw binary data.

Special thanks go to all our contributors and developers!

Here's the complete change log for this release (compared to the last
CPAN release, 0.25):

 *   feature: added new Test::Nginx::Socket::Lua::Dgram module for
     testing UDP/datagram nginx servers.

 *   feature: added new section, `--- response_body_filters`, to
     allow custom value filters applied upon the *actual* response
     body data before matching against the expected values. thanks
     detailyang for the patch.

 *   feature: added support for env TEST_NGINX_RANDOMIZE, which when
     set allows parallel testing via `prove -jN`.

 *   feature: added support for the `$TEST_NGINX_SERVER_ROOT` special
     macro variable in test block specs.

 *   feature: allows extracting nginx version numbers from more
     forked versions of nginx.

 *   feature: support the "SKIP" section dynamically defined by
     subclasses of the test scaffold calsses.

 *   feature: `--- tcp_reply` section: allows perl subroutines as
     section values. thanks Robert Paprocki for the patch.

 *   bugfix: fixed the TEST_NGINX_BINARY environment for specifying
     nginx binary path. thanks Thibault Charbonnier for the patch.

 *   bugfix: ensure that kill_process() still kills the process with
     force if the process is still running after sending SIGQUIT.

 *   improve: improved the nginx shut down logic. thanks Dejiang Zhu
     for the suggestion.

 *   improve: improved the test message for ARRAY-typed
     "response_body" section values.

 *   improve: improved the dry run skip message for no_error_log.

 *   doc: typo fixes from Juntong Fu.

This Perl module provides a test scaffold based on IO::Socket
for automated testing in Nginx C module or ngx_lua-based Lua library

This class inherits from Test::Base, thus bringing all its declarative
power to the Nginx C module testing practices.

Please check out the full documentation on CPAN:


as well as the official user guide in the book "Programming OpenResty":


All of our Nginx modules (as well as our lua-resty-* libraries) are
using Test::Nginx to drive their test suites. And it is also driving
my test cluster running on Amazon EC2:


Please note that this module is completely different from the
Test::Nginx module created by Maxim Dounin.

The git repository for this Perl module is hosted on GitHub:



Best regards,

More information about the nginx-devel mailing list