Mercurial > hg > nginx-tests
comparison stream_tcp_nodelay.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 |
---|---|
42 stream { | 42 stream { |
43 proxy_buffer_size 1; | 43 proxy_buffer_size 1; |
44 tcp_nodelay off; | 44 tcp_nodelay off; |
45 | 45 |
46 server { | 46 server { |
47 listen 127.0.0.1:%%PORT_1%%; | 47 listen 127.0.0.1:8081; |
48 proxy_pass 127.0.0.1:%%PORT_0%%; | 48 proxy_pass 127.0.0.1:8080; |
49 } | 49 } |
50 | 50 |
51 server { | 51 server { |
52 tcp_nodelay on; | 52 tcp_nodelay on; |
53 listen 127.0.0.1:%%PORT_2%%; | 53 listen 127.0.0.1:8082; |
54 proxy_pass 127.0.0.1:%%PORT_0%%; | 54 proxy_pass 127.0.0.1:8080; |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 EOF | 58 EOF |
59 | 59 |
60 $t->run_daemon(\&stream_daemon); | 60 $t->run_daemon(\&stream_daemon); |
61 $t->run()->waitforsocket('127.0.0.1:' . port(0)); | 61 $t->run()->waitforsocket('127.0.0.1:' . port(8080)); |
62 | 62 |
63 ############################################################################### | 63 ############################################################################### |
64 | 64 |
65 my $str = '1234567890' x 10 . 'F'; | 65 my $str = '1234567890' x 10 . 'F'; |
66 my $length = length($str); | 66 my $length = length($str); |
67 | 67 |
68 is(stream('127.0.0.1:' . port(1))->io($str, length => $length), $str, | 68 is(stream('127.0.0.1:' . port(8081))->io($str, length => $length), $str, |
69 'tcp_nodelay off'); | 69 'tcp_nodelay off'); |
70 is(stream('127.0.0.1:' . port(2))->io($str, length => $length), $str, | 70 is(stream('127.0.0.1:' . port(8082))->io($str, length => $length), $str, |
71 'tcp_nodelay on'); | 71 'tcp_nodelay on'); |
72 | 72 |
73 ############################################################################### | 73 ############################################################################### |
74 | 74 |
75 sub stream_daemon { | 75 sub stream_daemon { |
76 my $server = IO::Socket::INET->new( | 76 my $server = IO::Socket::INET->new( |
77 Proto => 'tcp', | 77 Proto => 'tcp', |
78 LocalAddr => '127.0.0.1:' . port(0), | 78 LocalAddr => '127.0.0.1:' . port(8080), |
79 Listen => 5, | 79 Listen => 5, |
80 Reuse => 1 | 80 Reuse => 1 |
81 ) | 81 ) |
82 or die "Can't create listening socket: $!\n"; | 82 or die "Can't create listening socket: $!\n"; |
83 | 83 |