I've just uploaded Test::Nginx 0.18 to CPAN:
It will appear on the CPAN mirror near you in the next few hours or so.
Special thanks go to all of our users :)
Here's the complete change log for this release, compared to the last
CPAN release, 0.17:
* feature: added new section "--- no_error_log" which could be used to
specify patterns of lines that do not appear in error.log at all.
* feature: added MOCKEAGAIN_VERBOSE, DYLD_INSERT_LIBRARIES,
TOCKEAGAIN_WRITE_TIMEOUT_PATTERN, and LD_PRELOAD to the environments
that should be kept through nginx reload and restart.
* doc: added Naxsi and ngx_rds_csv to the user module list in the POD
* feature: now we can use the environment TEST_NGINX_USE_VALGRIND to
specify the valgrind command-line options, when set to 1 or other
non-zero numbers, it is effectively equivalent to the value
"--tool=memcheck --leak-check=full". To use Valgrind SGCheck to run
the tests, just specify the environment
* feature: added support for environment TEST_NGINX_VERBOSE.
* feature: added support for environment TEST_NGINX_USE_HUP.
* feature: added support for the TEST_NGINX_POSTPONE_OUTPUT environment.
* feature: now we'll retry sending the QUIT signal for at most 5 times
when the nginx process is refusing to quit. after 5 trials, KILL
signal will be sent.
* feature: exposes the "master_off" API which turns off the nginx
* feature: added new section "--- ignore_response" to test bad responses.
bugfix: Test::Nginx::Socket will retry 10 times if fail to connect
because nginx with valgrind can be very slow to start in some systems.
* feature: added new section name "--- error_log" to test error lines.
requested by Piotr Sikora in the last year or so.
* feature: added the TEST_NGINX_EVENT_TYPE environment to specify an
event API type (like "epoll" or "select") when running the test suite.
This Perl module provides a test scaffold based on IO::Socket or LWP
for automated testing in Nginx C module development.
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:
All of our Nginx modules are using Test::Nginx to drive their test suites.
Please note that this module is completely different from the
Test::Nginx module created by Maxim Dounin.
You're right. At this point the only redis specific thing is parsing the
output of the subrequest to /backend. I could make future versions take a
token or regex that will parse the output into an array.
On Feb 2, 2012 3:50 AM, "agentzh" <agentzh(a)gmail.com> wrote:
Sorry for the confusion. I don't want failover/backup for redis servers, I
want the redis request to return multiple upstreams that I can proxy to
E.g. I get a request for Foo.com. I ask redis for a list of upstream
servers to which I can serve Foo.com. I then feed the entire list somehow
into proxy_pass. It then performs its normal htttp_upstream operation as
if it had a standard list of peers in an upstream.
On Jan 31, 2012 11:25 PM, "agentzh" <agentzh(a)gmail.com> wrote:
I have a requirement to route dynamically by domain to a set of all
participating peers similar to the Dynamic Request Routing Based on
Redis in Open Resty, the difference is that if one upstream peer is
down, I'd like to fail over to the next one. So Redis would return a
priority-sorted list of upstream peers for any given domain instead of
My plan is to build make an array of peer structs available to lua so
that my lua script can populate the array on each upstream.init. Then
a custom upstream->peers.get/free would set or reset the current
I think that this would mean that I would have to have a custom upstream.
Is there an easier way?
In ngx_http_upstream_rewrite_location(), r->upstream->rewrite_redirect may
replace the Location header value with a new value. This value ends up
going through ngx_http_header_filter(), and if it's a relative URL, the
header filter adds a scheme and host to it. However, if
r->upstream->rewrite_redirect declines (rc = NGX_DECLINED) to rewrite the
redirect, the value does not go through ngx_http_header_filter() even if it
is a relative URL.
Is this intended behavior? If it is not, I attached a patch that sets