Mercurial > hg > ngx_http_upstream_keepalive
comparison t/memcached-keepalive.t @ 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 | 181a487581b7 |
children | 8d8eaaf07663 |
comparison
equal
deleted
inserted
replaced
18:2054159546d0 | 19:2ce9d8a1ca93 |
---|---|
92 } | 92 } |
93 } | 93 } |
94 | 94 |
95 EOF | 95 EOF |
96 | 96 |
97 if (`memcached -h` =~ /repcached/) { | 97 my $memhelp = `memcached -h`; |
98 my @memopts1 = (); | |
99 my @memopts2 = (); | |
100 | |
101 if ($memhelp =~ /repcached/) { | |
98 # repcached patches adds additional listen socket memcached | 102 # repcached patches adds additional listen socket memcached |
99 # that should be different too | 103 # that should be different too |
100 | 104 |
101 $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8081', | 105 push @memopts1, '-X', '8091'; |
102 '-X', '8091'); | 106 push @memopts2, '-X', '8092'; |
103 $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8082', | 107 } |
104 '-X', '8092'); | 108 if ($memhelp =~ /-U/) { |
105 | 109 # UDP ports no longer off by default in memcached 1.2.7+ |
106 } else { | 110 |
107 $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8081'); | 111 push @memopts1, '-U', '0'; |
108 $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8082'); | 112 push @memopts2, '-U', '0'; |
109 } | 113 } |
114 | |
115 $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8081', @memopts1); | |
116 $t->run_daemon('memcached', '-l', '127.0.0.1', '-p', '8082', @memopts2); | |
110 | 117 |
111 $t->run(); | 118 $t->run(); |
112 | 119 |
113 $t->waitforsocket('127.0.0.1:8081') | 120 $t->waitforsocket('127.0.0.1:8081') |
114 or die "Unable to start memcached"; | 121 or die "Unable to start memcached"; |