Mercurial > hg > ngx_http_upstream_keepalive
changeset 19:2ce9d8a1ca93
Keepalive: fix tests for memcached 1.2.7+.
UDP ports are on by default in 1.2.7+, so we have to explicitly switch them
off to avoid conflicts when running two memcached servers.
Do it conditionally for now to keep compatibility with old memcached servers
without UDP support. Not sure it's really needed since UDP support is here
since memcached 1.2.1, probably should be done unconditionally instead.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 28 Aug 2009 20:45:15 +0400 |
parents | 2054159546d0 |
children | 8d8eaaf07663 |
files | t/memcached-keepalive.t |
diffstat | 1 files changed, 15 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/t/memcached-keepalive.t +++ b/t/memcached-keepalive.t @@ -94,20 +94,27 @@ http { EOF -if (`memcached -h` =~ /repcached/) { +my $memhelp = `memcached -h`; +my @memopts1 = (); +my @memopts2 = (); + +if ($memhelp =~ /repcached/) { # repcached patches adds additional listen socket memcached # that should be different too - $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8081', - '-X', '8091'); - $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8082', - '-X', '8092'); + push @memopts1, '-X', '8091'; + push @memopts2, '-X', '8092'; +} +if ($memhelp =~ /-U/) { + # UDP ports no longer off by default in memcached 1.2.7+ -} else { - $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8081'); - $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8082'); + push @memopts1, '-U', '0'; + push @memopts2, '-U', '0'; } +$t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8081', @memopts1); +$t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8082', @memopts2); + $t->run(); $t->waitforsocket('127.0.0.1:8081')