comparison stream_proxy_next_upstream.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 875967f737d4
comparison
equal deleted inserted replaced
973:7d7aef8b9f3a 974:882267679006
34 events { 34 events {
35 } 35 }
36 36
37 stream { 37 stream {
38 upstream u { 38 upstream u {
39 server 127.0.0.1:%%PORT_3%% max_fails=0; 39 server 127.0.0.1:8083 max_fails=0;
40 server 127.0.0.1:%%PORT_4%% max_fails=0; 40 server 127.0.0.1:8084 max_fails=0;
41 server 127.0.0.1:%%PORT_5%% backup; 41 server 127.0.0.1:8085 backup;
42 } 42 }
43 43
44 upstream u2 { 44 upstream u2 {
45 server 127.0.0.1:%%PORT_3%%; 45 server 127.0.0.1:8083;
46 server 127.0.0.1:%%PORT_5%% backup; 46 server 127.0.0.1:8085 backup;
47 } 47 }
48 48
49 proxy_connect_timeout 1s; 49 proxy_connect_timeout 1s;
50 50
51 server { 51 server {
52 listen 127.0.0.1:%%PORT_0%%; 52 listen 127.0.0.1:8080;
53 proxy_pass u; 53 proxy_pass u;
54 proxy_next_upstream off; 54 proxy_next_upstream off;
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 u2; 59 proxy_pass u2;
60 proxy_next_upstream on; 60 proxy_next_upstream on;
61 } 61 }
62 62
63 server { 63 server {
64 listen 127.0.0.1:%%PORT_2%%; 64 listen 127.0.0.1:8082;
65 proxy_pass u; 65 proxy_pass u;
66 proxy_next_upstream on; 66 proxy_next_upstream on;
67 proxy_next_upstream_tries 2; 67 proxy_next_upstream_tries 2;
68 } 68 }
69 } 69 }
70 70
71 EOF 71 EOF
72 72
73 $t->run_daemon(\&stream_daemon); 73 $t->run_daemon(\&stream_daemon);
74 $t->run()->waitforsocket('127.0.0.1:' . port(5)); 74 $t->run()->waitforsocket('127.0.0.1:' . port(8085));
75 75
76 ############################################################################### 76 ###############################################################################
77 77
78 is(stream('127.0.0.1:' . port(0))->io('.'), '', 'next off'); 78 is(stream('127.0.0.1:' . port(8080))->io('.'), '', 'next off');
79 is(stream('127.0.0.1:' . port(1))->io('.'), 'SEE-THIS', 'next on'); 79 is(stream('127.0.0.1:' . port(8081))->io('.'), 'SEE-THIS', 'next on');
80 80
81 # make sure backup is not tried 81 # make sure backup is not tried
82 82
83 is(stream('127.0.0.1:' . port(2))->io('.'), '', 'next tries'); 83 is(stream('127.0.0.1:' . port(8082))->io('.'), '', 'next tries');
84 84
85 ############################################################################### 85 ###############################################################################
86 86
87 sub stream_daemon { 87 sub stream_daemon {
88 my $server = IO::Socket::INET->new( 88 my $server = IO::Socket::INET->new(
89 Proto => 'tcp', 89 Proto => 'tcp',
90 LocalHost => '127.0.0.1:' . port(5), 90 LocalHost => '127.0.0.1:' . port(8085),
91 Listen => 5, 91 Listen => 5,
92 Reuse => 1 92 Reuse => 1
93 ) 93 )
94 or die "Can't create listening socket: $!\n"; 94 or die "Can't create listening socket: $!\n";
95 95