comparison stream_proxy_protocol_ipv6.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 196d33c2bb45
comparison
equal deleted inserted replaced
973:7d7aef8b9f3a 974:882267679006
36 events { 36 events {
37 } 37 }
38 38
39 stream { 39 stream {
40 server { 40 server {
41 listen 127.0.0.1:%%PORT_0%%; 41 listen 127.0.0.1:8080;
42 proxy_pass [::1]:%%PORT_0%%; 42 proxy_pass [::1]:%%PORT_8080%%;
43 } 43 }
44 44
45 server { 45 server {
46 listen 127.0.0.1:%%PORT_1%%; 46 listen 127.0.0.1:8081;
47 proxy_pass [::1]:%%PORT_1%%; 47 proxy_pass [::1]:%%PORT_8081%%;
48 } 48 }
49 49
50 server { 50 server {
51 listen [::1]:%%PORT_0%%; 51 listen [::1]:%%PORT_8080%%;
52 proxy_pass 127.0.0.1:%%PORT_2%%; 52 proxy_pass 127.0.0.1:8082;
53 proxy_protocol on; 53 proxy_protocol on;
54 } 54 }
55 55
56 server { 56 server {
57 listen [::1]:%%PORT_1%%; 57 listen [::1]:%%PORT_8081%%;
58 proxy_pass 127.0.0.1:%%PORT_2%%; 58 proxy_pass 127.0.0.1:8082;
59 } 59 }
60 } 60 }
61 61
62 EOF 62 EOF
63 63
64 $t->run_daemon(\&stream_daemon); 64 $t->run_daemon(\&stream_daemon);
65 $t->try_run('no inet6 support or stream proxy_protocol')->plan(2); 65 $t->try_run('no inet6 support or stream proxy_protocol')->plan(2);
66 $t->waitforsocket('127.0.0.1:' . port(2)); 66 $t->waitforsocket('127.0.0.1:' . port(8082));
67 67
68 ############################################################################### 68 ###############################################################################
69 69
70 my $dp = port(0); 70 my $dp = port(8080);
71 71
72 like(stream('127.0.0.1:' . $dp)->io('close'), 72 like(stream('127.0.0.1:' . $dp)->io('close'),
73 qr/PROXY TCP6 ::1 ::1 \d+ $dp$CRLF/, 'protocol on'); 73 qr/PROXY TCP6 ::1 ::1 \d+ $dp$CRLF/, 'protocol on');
74 unlike(stream('127.0.0.1:' . port(1))->io('close'), qr/PROXY/, 74 unlike(stream('127.0.0.1:' . port(8081))->io('close'), qr/PROXY/,
75 'protocol off'); 75 'protocol off');
76 76
77 ############################################################################### 77 ###############################################################################
78 78
79 sub stream_daemon { 79 sub stream_daemon {
80 my $server = IO::Socket::INET->new( 80 my $server = IO::Socket::INET->new(
81 Proto => 'tcp', 81 Proto => 'tcp',
82 LocalHost => '127.0.0.1:' . port(2), 82 LocalHost => '127.0.0.1:' . port(8082),
83 Listen => 5, 83 Listen => 5,
84 Reuse => 1 84 Reuse => 1
85 ) 85 )
86 or die "Can't create listening socket: $!\n"; 86 or die "Can't create listening socket: $!\n";
87 87