comparison upstream_hash_memcached.t @ 1250:b708848eb49a

Tests: handled Cache::Memcached::Fast brokenness.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 23 Nov 2017 14:42:47 +0300
parents 673c3e12214e
children
comparison
equal deleted inserted replaced
1249:673c3e12214e 1250:b708848eb49a
140 $memd = new Cache::Memcached::Fast({ ketama_points => 160, servers => [ 140 $memd = new Cache::Memcached::Fast({ ketama_points => 160, servers => [
141 '127.0.0.1:' . port(8081), 141 '127.0.0.1:' . port(8081),
142 '127.0.0.1:' . port(8082), 142 '127.0.0.1:' . port(8082),
143 '127.0.0.1:' . port(8083)] }); 143 '127.0.0.1:' . port(8083)] });
144 144
145 # Cache::Memcached::Fast may be incompatible with recent Perl,
146 # see https://github.com/JRaspass/Cache-Memcached-Fast/issues/12
147
148 my $cmf_bug = ! keys %{$memd->server_versions};
149
150 SKIP: {
151 skip 'Cache::Memcached::Fast bug', 1 if $cmf_bug;
152
145 is_deeply(ngx('/c'), mem($memd), 'cache::memcached::fast'); 153 is_deeply(ngx('/c'), mem($memd), 'cache::memcached::fast');
154
155 }
146 156
147 $memd = new Cache::Memcached(servers => [ 157 $memd = new Cache::Memcached(servers => [
148 [ '127.0.0.1:' . port(8081), 2 ], 158 [ '127.0.0.1:' . port(8081), 2 ],
149 [ '127.0.0.1:' . port(8082), 3 ], 159 [ '127.0.0.1:' . port(8082), 3 ],
150 [ '127.0.0.1:' . port(8083), 1 ]]); 160 [ '127.0.0.1:' . port(8083), 1 ]]);
154 $memd = new Cache::Memcached::Fast({ ketama_points => 160, servers => [ 164 $memd = new Cache::Memcached::Fast({ ketama_points => 160, servers => [
155 { address => '127.0.0.1:' . port(8081), weight => 2 }, 165 { address => '127.0.0.1:' . port(8081), weight => 2 },
156 { address => '127.0.0.1:' . port(8082), weight => 3 }, 166 { address => '127.0.0.1:' . port(8082), weight => 3 },
157 { address => '127.0.0.1:' . port(8083), weight => 1 }] }); 167 { address => '127.0.0.1:' . port(8083), weight => 1 }] });
158 168
169 SKIP: {
170 skip 'Cache::Memcached::Fast bug', 1 if $cmf_bug;
171
159 is_deeply(ngx('/cw'), mem($memd), 'cache::memcached::fast weight'); 172 is_deeply(ngx('/cw'), mem($memd), 'cache::memcached::fast weight');
173
174 }
160 175
161 ############################################################################### 176 ###############################################################################
162 177
163 sub ngx { 178 sub ngx {
164 my ($uri) = @_; 179 my ($uri) = @_;