Mercurial > hg > nginx-tests
diff upstream_max_conns.t @ 1394:3c101e516213
Tests: added upstream max_conns tests with hash balancer.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 07 Nov 2018 15:07:23 +0300 |
parents | 23cf08e9d2a2 |
children |
line wrap: on
line diff
--- a/upstream_max_conns.t +++ b/upstream_max_conns.t @@ -24,7 +24,7 @@ select STDERR; $| = 1; select STDOUT; $| = 1; my $t = Test::Nginx->new()->has(qw/http proxy rewrite upstream_least_conn/) - ->has(qw/upstream_ip_hash/)->plan(14); + ->has(qw/upstream_ip_hash upstream_hash/)->plan(16); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -104,6 +104,17 @@ http { server 127.0.0.1:8082 max_conns=2; } + upstream u_hash { + hash $remote_addr; + server 127.0.0.1:8081 max_conns=1; + server 127.0.0.1:8082 max_conns=2; + } + upstream u_chash { + hash $remote_addr consistent; + server 127.0.0.1:8081 max_conns=1; + server 127.0.0.1:8082 max_conns=2; + } + server { listen 127.0.0.1:8084; server_name localhost; @@ -200,6 +211,11 @@ is(peers('/u_lc_backup_lim', 6), "$p1 $p is(parallel('/u_ih', 4), "$p1: 1, $p2: 2", 'ip_hash'); +# hash balancer tests + +is(parallel('/u_hash', 4), "$p1: 1, $p2: 2", 'hash'); +is(parallel('/u_chash', 4), "$p1: 1, $p2: 2", 'hash consistent'); + ############################################################################### sub peers {