Mercurial > hg > nginx-tests
comparison stream_upstream_least_conn.t @ 974:882267679006
Tests: simplified parallel modifications in tests.
Mail tests were simplified in c227348453db.
author | Andrey Zelenkov <zelenkov@nginx.com> |
---|---|
date | Tue, 12 Jul 2016 17:39:03 +0300 |
parents | e9064d691790 |
children | 3fc6817cd84a |
comparison
equal
deleted
inserted
replaced
973:7d7aef8b9f3a | 974:882267679006 |
---|---|
36 } | 36 } |
37 | 37 |
38 stream { | 38 stream { |
39 upstream u { | 39 upstream u { |
40 least_conn; | 40 least_conn; |
41 server 127.0.0.1:%%PORT_1%%; | 41 server 127.0.0.1:8081; |
42 server 127.0.0.1:%%PORT_2%%; | 42 server 127.0.0.1:8082; |
43 } | 43 } |
44 | 44 |
45 server { | 45 server { |
46 listen 127.0.0.1:%%PORT_0%%; | 46 listen 127.0.0.1:8080; |
47 proxy_pass u; | 47 proxy_pass u; |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 EOF | 51 EOF |
52 | 52 |
53 $t->run_daemon(\&stream_daemon, port(1)); | 53 $t->run_daemon(\&stream_daemon, port(8081)); |
54 $t->run_daemon(\&stream_daemon, port(2)); | 54 $t->run_daemon(\&stream_daemon, port(8082)); |
55 $t->run(); | 55 $t->run(); |
56 | 56 |
57 $t->waitforsocket('127.0.0.1:' . port(1)); | 57 $t->waitforsocket('127.0.0.1:' . port(8081)); |
58 $t->waitforsocket('127.0.0.1:' . port(2)); | 58 $t->waitforsocket('127.0.0.1:' . port(8082)); |
59 | 59 |
60 ############################################################################### | 60 ############################################################################### |
61 | 61 |
62 my @ports = my ($port1, $port2) = (port(1), port(2)); | 62 my @ports = my ($port1, $port2) = (port(8081), port(8082)); |
63 | 63 |
64 is(many(10), "$port1: 5, $port2: 5", 'balanced'); | 64 is(many(10), "$port1: 5, $port2: 5", 'balanced'); |
65 | 65 |
66 my @sockets; | 66 my @sockets; |
67 for (1 .. 2) { | 67 for (1 .. 2) { |
133 | 133 |
134 log2i("$client $buffer"); | 134 log2i("$client $buffer"); |
135 | 135 |
136 my $port = $client->sockport(); | 136 my $port = $client->sockport(); |
137 | 137 |
138 if ($buffer =~ /w/ && $port == port(1)) { | 138 if ($buffer =~ /w/ && $port == port(8081)) { |
139 Test::Nginx::log_core('||', "$port: sleep(2.5)"); | 139 Test::Nginx::log_core('||', "$port: sleep(2.5)"); |
140 select undef, undef, undef, 2.5; | 140 select undef, undef, undef, 2.5; |
141 } | 141 } |
142 | 142 |
143 $buffer = $port; | 143 $buffer = $port; |