Mercurial > hg > nginx-tests
annotate stream_upstream_random.t @ 1896:8b74936ff2ac
Tests: added has_feature() test for CryptX.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 29 May 2023 17:04:36 +0400 |
parents | f3ba4c74de31 |
children |
rev | line source |
---|---|
1350
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
2 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
3 # (C) Sergey Kandaurov |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
5 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
6 # Tests for upstream random balancer module. |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
7 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
9 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
11 use strict; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
12 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
14 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
15 BEGIN { use FindBin; chdir($FindBin::Bin); } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
16 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
17 use lib 'lib'; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
18 use Test::Nginx qw/ :DEFAULT http_end /; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
19 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
20 ############################################################################### |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
21 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
22 select STDERR; $| = 1; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
23 select STDOUT; $| = 1; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
24 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
25 my $t = Test::Nginx->new() |
1535
144c6ce732e4
Tests: removed TODO and try_run() checks for legacy versions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1505
diff
changeset
|
26 ->has(qw/stream stream_upstream_zone stream_upstream_random/)->plan(12) |
1350
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
27 ->write_file_expand('nginx.conf', <<'EOF'); |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
28 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
29 %%TEST_GLOBALS%% |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
30 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
31 daemon off; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
32 worker_processes 2; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
33 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
34 events { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
35 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
36 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
37 stream { |
1609
f3ba4c74de31
Tests: added TEST_GLOBALS_STREAM variable support.
Andrei Belov <defan@nginx.com>
parents:
1535
diff
changeset
|
38 %%TEST_GLOBALS_STREAM%% |
f3ba4c74de31
Tests: added TEST_GLOBALS_STREAM variable support.
Andrei Belov <defan@nginx.com>
parents:
1535
diff
changeset
|
39 |
1350
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
40 upstream u { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
41 zone z 1m; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
42 random; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
43 server 127.0.0.1:8081; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
44 server 127.0.0.1:8082; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
45 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
46 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
47 upstream lc { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
48 zone lc 1m; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
49 random two; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
50 server 127.0.0.1:8081; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
51 server 127.0.0.1:8082; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
52 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
53 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 upstream w { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
55 zone w 1m; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
56 random two least_conn; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
57 server 127.0.0.1:8081; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
58 server 127.0.0.1:8082 weight=2; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
59 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
60 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
61 upstream mc { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
62 zone mc 1m; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
63 random; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
64 server 127.0.0.1:8081 max_conns=2; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
65 server 127.0.0.1:8082 max_conns=1; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
66 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
67 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
68 upstream mc2 { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
69 zone mc 1m; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
70 random two; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
71 server 127.0.0.1:8081 max_conns=2; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
72 server 127.0.0.1:8082 max_conns=1; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
73 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
74 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
75 upstream one { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
76 random; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
77 server 127.0.0.1:8081; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
78 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
79 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
80 upstream two { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
81 random two; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
82 server 127.0.0.1:8081; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
83 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
84 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
85 upstream zone { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
86 zone z 1m; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
87 random; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
88 server 127.0.0.1:8081; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
89 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
90 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
91 upstream ztwo { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
92 zone z 1m; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
93 random two; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
94 server 127.0.0.1:8081; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
95 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
96 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
97 upstream fail { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
98 zone fail 1m; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
99 random; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
100 server 127.0.0.1:8096; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
101 server 127.0.0.1:8083 down; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
102 server 127.0.0.1:8082; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
103 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
104 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
105 upstream fail2 { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
106 zone fail2 1m; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
107 random two; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
108 server 127.0.0.1:8096; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
109 server 127.0.0.1:8083 down; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
110 server 127.0.0.1:8082; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
111 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
112 |
1505
76090a5da00b
Tests: unbreak various tests with TCP blackhole.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1469
diff
changeset
|
113 proxy_connect_timeout 2; |
76090a5da00b
Tests: unbreak various tests with TCP blackhole.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1469
diff
changeset
|
114 |
1350
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
115 server { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
116 listen 127.0.0.1:8080; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
117 proxy_pass u; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
118 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
119 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
120 server { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
121 listen 127.0.0.1:8083; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
122 proxy_pass lc; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
123 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
124 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
125 server { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
126 listen 127.0.0.1:8084; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
127 proxy_pass w; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
128 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
129 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
130 server { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
131 listen 127.0.0.1:8085; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
132 proxy_pass mc; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
133 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
134 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
135 server { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
136 listen 127.0.0.1:8086; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
137 proxy_pass mc2; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
138 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
139 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
140 server { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
141 listen 127.0.0.1:8087; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
142 proxy_pass one; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
143 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
144 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
145 server { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
146 listen 127.0.0.1:8088; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
147 proxy_pass two; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
148 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
149 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
150 server { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
151 listen 127.0.0.1:8089; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
152 proxy_pass zone; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
153 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
154 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
155 server { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
156 listen 127.0.0.1:8090; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
157 proxy_pass ztwo; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
158 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
159 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
160 server { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
161 listen 127.0.0.1:8091; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
162 proxy_pass fail; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
163 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
164 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
165 server { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
166 listen 127.0.0.1:8092; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
167 proxy_pass fail2; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
168 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
169 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
170 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
171 EOF |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
172 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
173 $t->run_daemon(\&http_daemon, port(8081)); |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
174 $t->run_daemon(\&http_daemon, port(8082)); |
1535
144c6ce732e4
Tests: removed TODO and try_run() checks for legacy versions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1505
diff
changeset
|
175 $t->run(); |
1350
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
176 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
177 $t->waitforsocket('127.0.0.1:' . port(8081)); |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
178 $t->waitforsocket('127.0.0.1:' . port(8082)); |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
179 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
180 ############################################################################### |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
181 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
182 my @ports = my ($port1, $port2) = (port(8081), port(8082)); |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
183 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
184 like(get(8080, '/'), qr/X-Port: ($port1|$port2)/, 'random'); |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
185 like(get(8083, '/'), qr/X-Port: ($port1|$port2)/, 'random two'); |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
186 |
1369
a37d8526e691
Tests: adjusted delay in upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1350
diff
changeset
|
187 my $s = get(8083, '/w', start => 1, sleep => 0.5); |
1350
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
188 my $r = get(8083, '/'); |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
189 my ($p) = http_end($s) =~ /X-Port: (\d+)/; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
190 like($r, qr/X-Port: (?!$p)/, 'random wait'); |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
191 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
192 SKIP: { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
193 skip 'long test', 3 unless $ENV{TEST_NGINX_UNSAFE}; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
194 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
195 is(parallel(8084, '/w', 3), "$port1: 1, $port2: 2", 'random weight'); |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
196 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
197 is(parallel(8085, '/w', 4), "$port1: 2, $port2: 1", 'max_conns'); |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
198 is(parallel(8086, '/w', 4), "$port1: 2, $port2: 1", 'max_conns two'); |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
199 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
200 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
201 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
202 # single variants |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
203 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
204 like(get(8087, '/'), qr/X-Port: $port1/, 'single one'); |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
205 like(get(8088, '/'), qr/X-Port: $port1/, 'single two'); |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
206 like(get(8089, '/'), qr/X-Port: $port1/, 'zone one'); |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
207 like(get(8090, '/'), qr/X-Port: $port1/, 'zone two'); |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
208 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
209 like(many(8091, '/', 10), qr/$port2: 10/, 'failures'); |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
210 like(many(8092, '/', 10), qr/$port2: 10/, 'failures two'); |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
211 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
212 ############################################################################### |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
213 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
214 sub get { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
215 my ($port, $uri, %opts) = @_; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
216 my $s = IO::Socket::INET->new( |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
217 Proto => 'tcp', |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
218 PeerAddr => '127.0.0.1', |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
219 PeerPort => port($port), |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
220 ) |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
221 or die "Can't connect to nginx: $!\n"; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
222 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
223 http_get($uri, socket => $s, %opts); |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
224 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
225 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
226 sub many { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
227 my ($port, $uri, $count, %opts) = @_; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
228 my %ports; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
229 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
230 for (1 .. $count) { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
231 if (get($port, $uri) =~ /X-Port: (\d+)/) { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
232 $ports{$1} = 0 unless defined $ports{$1}; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
233 $ports{$1}++; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
234 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
235 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
236 select undef, undef, undef, $opts{delay} if $opts{delay}; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
237 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
238 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
239 my @keys = map { my $p = $_; grep { $p == $_ } keys %ports } @ports; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
240 return join ', ', map { $_ . ": " . $ports{$_} } @keys; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
241 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
242 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
243 sub parallel { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
244 my ($port, $uri, $n) = @_; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
245 my %ports; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
246 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
247 my @s = map { get($port, $uri, start => 1, sleep => 0.1) } (1 .. $n); |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
248 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
249 for (@s) { |
1469
30284bd9ab18
Tests: avoid uninitialized warnings in stream_upstream_random.t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1468
diff
changeset
|
250 my $r = http_end($_); |
30284bd9ab18
Tests: avoid uninitialized warnings in stream_upstream_random.t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1468
diff
changeset
|
251 if ($r && $r =~ /X-Port: (\d+)/) { |
1350
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
252 $ports{$1} = 0 unless defined $ports{$1}; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
253 $ports{$1}++; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
254 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
255 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
256 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
257 my @keys = map { my $p = $_; grep { $p == $_ } keys %ports } @ports; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
258 return join ', ', map { $_ . ": " . $ports{$_} } @keys; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
259 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
260 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
261 ############################################################################### |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
262 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
263 sub http_daemon { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
264 my ($port) = @_; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
265 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
266 my $server = IO::Socket::INET->new( |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
267 Proto => 'tcp', |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
268 LocalHost => '127.0.0.1', |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
269 LocalPort => $port, |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
270 Listen => 5, |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
271 Reuse => 1 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
272 ) |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
273 or die "Can't create listening socket: $!\n"; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
274 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
275 local $SIG{PIPE} = 'IGNORE'; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
276 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
277 while (my $client = $server->accept()) { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
278 $client->autoflush(1); |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
279 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
280 my $headers = ''; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
281 my $uri = ''; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
282 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
283 while (<$client>) { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
284 $headers .= $_; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
285 last if (/^\x0d?\x0a?$/); |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
286 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
287 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
288 $uri = $1 if $headers =~ /^\S+\s+([^ ]+)\s+HTTP/i; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
289 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
290 if ($uri eq '/w') { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
291 Test::Nginx::log_core('||', "$port: sleep(2.5)"); |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
292 select undef, undef, undef, 2.5; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
293 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
294 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
295 if ($uri eq '/close' && $port == port(8081)) { |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
296 next; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
297 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
298 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
299 Test::Nginx::log_core('||', "$port: response, 200"); |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
300 print $client <<EOF; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
301 HTTP/1.1 200 OK |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
302 Connection: close |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
303 X-Port: $port |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
304 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
305 OK |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
306 EOF |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
307 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
308 close $client; |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
309 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
310 } |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
311 |
fda743e92b31
Tests: upstream random tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
312 ############################################################################### |