comparison stream_upstream_hash.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 06fbf6269f38
comparison
equal deleted inserted replaced
973:7d7aef8b9f3a 974:882267679006
37 } 37 }
38 38
39 stream { 39 stream {
40 upstream hash { 40 upstream hash {
41 hash $remote_addr; 41 hash $remote_addr;
42 server 127.0.0.1:%%PORT_2%%; 42 server 127.0.0.1:8082;
43 server 127.0.0.1:%%PORT_3%%; 43 server 127.0.0.1:8083;
44 } 44 }
45 45
46 upstream cons { 46 upstream cons {
47 hash $remote_addr consistent; 47 hash $remote_addr consistent;
48 server 127.0.0.1:%%PORT_2%%; 48 server 127.0.0.1:8082;
49 server 127.0.0.1:%%PORT_3%%; 49 server 127.0.0.1:8083;
50 } 50 }
51 51
52 server { 52 server {
53 listen 127.0.0.1:%%PORT_0%%; 53 listen 127.0.0.1:8080;
54 proxy_pass hash; 54 proxy_pass hash;
55 } 55 }
56 56
57 server { 57 server {
58 listen 127.0.0.1:%%PORT_1%%; 58 listen 127.0.0.1:8081;
59 proxy_pass cons; 59 proxy_pass cons;
60 } 60 }
61 } 61 }
62 62
63 EOF 63 EOF
64 64
65 $t->run_daemon(\&stream_daemon, port(2)); 65 $t->run_daemon(\&stream_daemon, port(8082));
66 $t->run_daemon(\&stream_daemon, port(3)); 66 $t->run_daemon(\&stream_daemon, port(8083));
67 $t->run(); 67 $t->run();
68 68
69 $t->waitforsocket('127.0.0.1:' . port(2)); 69 $t->waitforsocket('127.0.0.1:' . port(8082));
70 $t->waitforsocket('127.0.0.1:' . port(3)); 70 $t->waitforsocket('127.0.0.1:' . port(8083));
71 71
72 ############################################################################### 72 ###############################################################################
73 73
74 my @ports = my ($port2, $port3) = (port(2), port(3)); 74 my @ports = my ($port2, $port3) = (port(8082), port(8083));
75 75
76 is(many(10, port(0)), "$port3: 10", 'hash'); 76 is(many(10, port(8080)), "$port3: 10", 'hash');
77 like(many(10, port(1)), qr/($port2|$port3): 10/, 'hash consistent'); 77 like(many(10, port(8081)), qr/($port2|$port3): 10/, 'hash consistent');
78 78
79 ############################################################################### 79 ###############################################################################
80 80
81 sub many { 81 sub many {
82 my ($count, $port) = @_; 82 my ($count, $port) = @_;