Skip to content

Commit ff5e637

Browse files
committed
updated test cases
1 parent 2662fe4 commit ff5e637

File tree

3 files changed

+71
-52
lines changed

3 files changed

+71
-52
lines changed

test/t/http_check.t

Lines changed: 48 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@ __DATA__
3333
=== TEST 1: the http_check test-single server
3434
--- http_config
3535
upstream test{
36-
server blog.163.com:80;
36+
server www.taobao.com:80;
3737
check interval=3000 rise=1 fall=5 timeout=2000 type=http;
3838
check_http_send "GET / HTTP/1.0\r\n\r\n";
3939
check_http_expect_alive http_2xx http_3xx;
4040
}
4141
4242
--- config
4343
location / {
44+
proxy_set_header host www.taobao.com;
4445
proxy_pass http://test;
4546
}
4647
@@ -51,8 +52,8 @@ GET /
5152
=== TEST 2: the http_check test-multi_server
5253
--- http_config
5354
upstream test{
54-
server blog.163.com:80;
55-
server blog.163.com:81;
55+
server www.taobao.com:80;
56+
server www.taobao.com:81;
5657
5758
check interval=3000 rise=1 fall=5 timeout=2000 type=http;
5859
check_http_send "GET / HTTP/1.0\r\n\r\n";
@@ -70,6 +71,7 @@ GET /
7071
7172
--- config
7273
location / {
74+
proxy_set_header host www.taobao.com;
7375
proxy_pass http://test;
7476
}
7577
@@ -80,16 +82,17 @@ GET /
8082
=== TEST 3: the http_check test
8183
--- http_config
8284
upstream test{
83-
server blog.163.com:80;
84-
server blog.163.com:81;
85+
server www.taobao.com:80;
86+
server www.taobao.com:81;
8587
8688
check interval=3000 rise=1 fall=5 timeout=2000 type=http;
8789
check_http_send "GET /foo HTTP/1.0\r\n\r\n";
88-
check_http_expect_alive http_2xx http_3xx;
90+
check_http_expect_alive http_2xx;
8991
}
9092
9193
--- config
9294
location / {
95+
proxy_set_header host www.taobao.com;
9396
proxy_pass http://test;
9497
}
9598
@@ -101,12 +104,13 @@ GET /
101104
=== TEST 4: the http_check without check directive
102105
--- http_config
103106
upstream test{
104-
server blog.163.com:80;
105-
server blog.163.com:81;
107+
server www.taobao.com:80;
108+
server www.taobao.com:81;
106109
}
107110
108111
--- config
109112
location / {
113+
proxy_set_header host www.taobao.com;
110114
proxy_pass http://test;
111115
}
112116
@@ -117,8 +121,8 @@ GET /
117121
=== TEST 5: the http_check which does not use the upstream
118122
--- http_config
119123
upstream test{
120-
server blog.163.com:80;
121-
server blog.163.com:81;
124+
server www.taobao.com:80;
125+
server www.taobao.com:81;
122126
123127
check interval=3000 rise=1 fall=5 timeout=2000 type=http;
124128
check_http_send "GET / HTTP/1.0\r\n\r\n";
@@ -127,7 +131,8 @@ GET /
127131
128132
--- config
129133
location / {
130-
proxy_pass http://blog.163.com;
134+
proxy_set_header host www.taobao.com;
135+
proxy_pass http://www.taobao.com;
131136
}
132137
133138
--- request
@@ -137,7 +142,7 @@ GET /
137142
=== TEST 6: the http_check test-single server
138143
--- http_config
139144
upstream test{
140-
server blog.163.com:80;
145+
server www.taobao.com:80;
141146
ip_hash;
142147
143148
check interval=3000 rise=1 fall=5 timeout=2000 type=http;
@@ -147,6 +152,7 @@ GET /
147152
148153
--- config
149154
location / {
155+
proxy_set_header host www.taobao.com;
150156
proxy_pass http://test;
151157
}
152158
@@ -157,8 +163,8 @@ GET /
157163
=== TEST 7: the http_check test-multi_server
158164
--- http_config
159165
upstream test{
160-
server blog.163.com:80;
161-
server blog.163.com:81;
166+
server www.taobao.com:80;
167+
server www.taobao.com:81;
162168
ip_hash;
163169
164170
check interval=3000 rise=1 fall=5 timeout=2000 type=http;
@@ -168,6 +174,7 @@ GET /
168174
169175
--- config
170176
location / {
177+
proxy_set_header host www.taobao.com;
171178
proxy_pass http://test;
172179
}
173180
@@ -178,17 +185,18 @@ GET /
178185
=== TEST 8: the http_check test
179186
--- http_config
180187
upstream test{
181-
server blog.163.com:80;
182-
server blog.163.com:81;
188+
server www.taobao.com:80;
189+
server www.taobao.com:81;
183190
ip_hash;
184191
185192
check interval=3000 rise=1 fall=5 timeout=2000 type=http;
186193
check_http_send "GET /foo HTTP/1.0\r\n\r\n";
187-
check_http_expect_alive http_2xx http_3xx;
194+
check_http_expect_alive http_2xx;
188195
}
189196
190197
--- config
191198
location / {
199+
proxy_set_header host www.taobao.com;
192200
proxy_pass http://test;
193201
}
194202
@@ -200,13 +208,14 @@ GET /
200208
=== TEST 9: the http_check without check directive
201209
--- http_config
202210
upstream test{
203-
server blog.163.com:80;
204-
server blog.163.com:81;
211+
server www.taobao.com:80;
212+
server www.taobao.com:81;
205213
ip_hash;
206214
}
207215
208216
--- config
209217
location / {
218+
proxy_set_header host www.taobao.com;
210219
proxy_pass http://test;
211220
}
212221
@@ -217,8 +226,8 @@ GET /
217226
=== TEST 10: the http_check which does not use the upstream
218227
--- http_config
219228
upstream test{
220-
server blog.163.com:80;
221-
server blog.163.com:81;
229+
server www.taobao.com:80;
230+
server www.taobao.com:81;
222231
ip_hash;
223232
224233
check interval=3000 rise=1 fall=5 timeout=2000 type=http;
@@ -228,7 +237,8 @@ GET /
228237
229238
--- config
230239
location / {
231-
proxy_pass http://blog.163.com;
240+
proxy_set_header host www.taobao.com;
241+
proxy_pass http://www.taobao.com;
232242
}
233243
234244
--- request
@@ -238,8 +248,8 @@ GET /
238248
=== TEST 11: the http_check which does not use the upstream, with variable
239249
--- http_config
240250
upstream test{
241-
server blog.163.com:80;
242-
server blog.163.com:81;
251+
server www.taobao.com:80;
252+
server www.taobao.com:81;
243253
ip_hash;
244254
245255
check interval=3000 rise=1 fall=5 timeout=2000 type=http;
@@ -252,7 +262,8 @@ GET /
252262
--- config
253263
location / {
254264
set $test "/";
255-
proxy_pass http://blog.163.com$test;
265+
proxy_set_header host www.taobao.com;
266+
proxy_pass http://www.taobao.com$test;
256267
}
257268
258269
--- request
@@ -264,7 +275,7 @@ GET /
264275
2: < 1.2.2
265276
--- http_config
266277
upstream test{
267-
server blog.163.com:80;
278+
server www.taobao.com:80;
268279
least_conn;
269280
270281
check interval=3000 rise=1 fall=5 timeout=2000 type=http;
@@ -274,6 +285,7 @@ GET /
274285
275286
--- config
276287
location / {
288+
proxy_set_header host www.taobao.com;
277289
proxy_pass http://test;
278290
}
279291
@@ -286,8 +298,8 @@ GET /
286298
2: < 1.2.2
287299
--- http_config
288300
upstream test{
289-
server blog.163.com:80;
290-
server blog.163.com:81;
301+
server www.taobao.com:80;
302+
server www.taobao.com:81;
291303
least_conn;
292304
293305
check interval=3000 rise=1 fall=5 timeout=2000 type=http;
@@ -297,6 +309,7 @@ GET /
297309
298310
--- config
299311
location / {
312+
proxy_set_header host www.taobao.com;
300313
proxy_pass http://test;
301314
}
302315
@@ -309,17 +322,18 @@ GET /
309322
2: < 1.2.2
310323
--- http_config
311324
upstream test{
312-
server blog.163.com:80;
313-
server blog.163.com:81;
325+
server www.taobao.com:80;
326+
server www.taobao.com:81;
314327
least_conn;
315328
316329
check interval=3000 rise=1 fall=5 timeout=2000 type=http;
317330
check_http_send "GET /foo HTTP/1.0\r\n\r\n";
318-
check_http_expect_alive http_2xx http_3xx;
331+
check_http_expect_alive http_2xx;
319332
}
320333
321334
--- config
322335
location / {
336+
proxy_set_header host www.taobao.com;
323337
proxy_pass http://test;
324338
}
325339
@@ -333,13 +347,14 @@ GET /
333347
2: < 1.2.2
334348
--- http_config
335349
upstream test{
336-
server blog.163.com:80;
337-
server blog.163.com:81;
350+
server www.taobao.com:80;
351+
server www.taobao.com:81;
338352
least_conn;
339353
}
340354
341355
--- config
342356
location / {
357+
proxy_set_header host www.taobao.com;
343358
proxy_pass http://test;
344359
}
345360

test/t/ssl_hello_check.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ __DATA__
4444
location / {
4545
proxy_pass https://test;
4646
}
47-
47+
4848
--- request
4949
GET /
5050
--- response_body_like: ^<(.*)>[\r\n\s\t]*$

test/t/tcp_check.t

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
#
44
# FILE: tcp_check.t
55
#
6-
# DESCRIPTION: test
6+
# DESCRIPTION: test
77
#
88
# FILES: ---
99
# BUGS: ---
1010
# NOTES: ---
1111
# AUTHOR: Weibin Yao (http://yaoweibin.cn/), [email protected]
12-
# COMPANY:
12+
# COMPANY:
1313
# VERSION: 1.0
1414
# CREATED: 03/02/2010 03:18:28 PM
1515
# REVISION: ---
@@ -33,15 +33,16 @@ __DATA__
3333
=== TEST 1: the tcp_check test
3434
--- http_config
3535
upstream test{
36-
server blog.163.com:80;
37-
server blog.163.com:81;
38-
server blog.163.com:82;
36+
server www.taobao.com:80;
37+
server www.taobao.com:81;
38+
server www.taobao.com:82;
3939
4040
check interval=3000 rise=1 fall=5 timeout=1000;
4141
}
4242
4343
--- config
44-
location / {
44+
location / {
45+
proxy_set_header host www.taobao.com;
4546
proxy_pass http://test;
4647
}
4748
@@ -52,16 +53,17 @@ GET /
5253
=== TEST 2: the tcp_check test with ip_hash
5354
--- http_config
5455
upstream test{
55-
server blog.163.com:80;
56-
server blog.163.com:81;
57-
server blog.163.com:82;
56+
server www.taobao.com:80;
57+
server www.taobao.com:81;
58+
server www.taobao.com:82;
5859
ip_hash;
5960
6061
check interval=3000 rise=1 fall=5 timeout=1000 type=tcp;
6162
}
6263
6364
--- config
64-
location / {
65+
location / {
66+
proxy_set_header host www.taobao.com;
6567
proxy_pass http://test;
6668
}
6769
@@ -72,16 +74,17 @@ GET /
7274
=== TEST 3: the tcp_check test which don't use the checked upstream
7375
--- http_config
7476
upstream test{
75-
server blog.163.com:80;
76-
server blog.163.com:81;
77-
server blog.163.com:82;
77+
server www.taobao.com:80;
78+
server www.taobao.com:81;
79+
server www.taobao.com:82;
7880
7981
check interval=3000 rise=1 fall=5 timeout=1000;
8082
}
8183
8284
--- config
8385
location / {
84-
proxy_pass http://blog.163.com;
86+
proxy_set_header host www.taobao.com;
87+
proxy_pass http://www.taobao.com;
8588
}
8689
8790
--- request
@@ -93,16 +96,17 @@ GET /
9396
2: < 1.2.2
9497
--- http_config
9598
upstream test{
96-
server blog.163.com:80;
97-
server blog.163.com:81;
98-
server blog.163.com:82;
99+
server www.taobao.com:80;
100+
server www.taobao.com:81;
101+
server www.taobao.com:82;
99102
least_conn;
100103
101104
check interval=3000 rise=1 fall=5 timeout=1000 type=tcp;
102105
}
103106
104107
--- config
105-
location / {
108+
location / {
109+
proxy_set_header host www.taobao.com;
106110
proxy_pass http://test;
107111
}
108112

0 commit comments

Comments
 (0)