Mercurial > hg > nginx-tests
diff upstream_max_conns.t @ 1391:62f06d8dfc63
Tests: ported upstream max_conns tests to stream, reduced diffs.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 07 Nov 2018 14:49:34 +0300 |
parents | 766bcbb632ee |
children | 23cf08e9d2a2 |
line wrap: on
line diff
--- a/upstream_max_conns.t +++ b/upstream_max_conns.t @@ -23,8 +23,8 @@ use Test::Nginx qw/ :DEFAULT http_end /; select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new() - ->has(qw/http proxy rewrite upstream_least_conn upstream_ip_hash/); +my $t = Test::Nginx->new()->has(qw/http proxy rewrite upstream_least_conn/) + ->has(qw/upstream_ip_hash/)->plan(14); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -132,9 +132,8 @@ http { EOF - $t->run_daemon(\&http_daemon, port(8081), port(8082), port(8085)); -$t->run()->plan(14); +$t->run(); $t->waitforsocket('127.0.0.1:' . port(8081)); $t->waitforsocket('127.0.0.1:' . port(8082)); @@ -148,18 +147,18 @@ my @ports = my ($p1, $p2) = (port(8081), is(parallel('/u_unlim?delay=0', 4), "$p1: 2, $p2: 2", 'unlimited'); -# simple test with limited peer - -is(parallel('/u_lim', 4), "$p1: 3", 'single'); - # reopen connection to test connection subtraction -my @s = http_get_multi('/u_lim', 1, 1.1); +my @s = http_get_multi('/u_lim', 2, 1.1); http_get('/u_lim/close'); push @s, http_get_multi('/u_lim', 1, 1.1); http_get('/closeall'); -is(http_end_multi(\@s), "$p1: 2", 'conn subtraction'); +is(http_end_multi(\@s), "$p1: 3", 'conn subtraction'); + +# simple test with limited peer + +is(parallel('/u_lim', 4), "$p1: 3", 'single'); # limited peer with backup peer