Mercurial > hg > nginx-tests
comparison proxy_next_upstream_tries.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 | e4974af3fb12 |
comparison
equal
deleted
inserted
replaced
973:7d7aef8b9f3a | 974:882267679006 |
---|---|
36 | 36 |
37 http { | 37 http { |
38 %%TEST_GLOBALS_HTTP%% | 38 %%TEST_GLOBALS_HTTP%% |
39 | 39 |
40 upstream u { | 40 upstream u { |
41 server 127.0.0.1:%%PORT_1%%; | 41 server 127.0.0.1:8081; |
42 server 127.0.0.1:%%PORT_1%%; | 42 server 127.0.0.1:8081; |
43 server 127.0.0.1:%%PORT_1%%; | 43 server 127.0.0.1:8081; |
44 } | 44 } |
45 | 45 |
46 upstream u2 { | 46 upstream u2 { |
47 server 127.0.0.1:%%PORT_1%%; | 47 server 127.0.0.1:8081; |
48 server 127.0.0.1:%%PORT_1%% backup; | 48 server 127.0.0.1:8081 backup; |
49 server 127.0.0.1:%%PORT_1%% backup; | 49 server 127.0.0.1:8081 backup; |
50 } | 50 } |
51 | 51 |
52 server { | 52 server { |
53 listen 127.0.0.1:%%PORT_0%%; | 53 listen 127.0.0.1:8080; |
54 server_name localhost; | 54 server_name localhost; |
55 | 55 |
56 proxy_next_upstream http_404; | 56 proxy_next_upstream http_404; |
57 proxy_intercept_errors on; | 57 proxy_intercept_errors on; |
58 error_page 404 /404; | 58 error_page 404 /404; |
66 proxy_pass http://u2; | 66 proxy_pass http://u2; |
67 proxy_next_upstream_tries 2; | 67 proxy_next_upstream_tries 2; |
68 } | 68 } |
69 | 69 |
70 location /tries/resolver { | 70 location /tries/resolver { |
71 resolver 127.0.0.1:%%PORT_2_UDP%%; | 71 resolver 127.0.0.1:%%PORT_8082_UDP%%; |
72 | 72 |
73 proxy_pass http://$host:%%PORT_1%%; | 73 proxy_pass http://$host:%%PORT_8081%%; |
74 proxy_next_upstream_tries 2; | 74 proxy_next_upstream_tries 2; |
75 } | 75 } |
76 | 76 |
77 location /tries/zero { | 77 location /tries/zero { |
78 proxy_pass http://u; | 78 proxy_pass http://u; |
88 proxy_pass http://u2/w2; | 88 proxy_pass http://u2/w2; |
89 proxy_next_upstream_timeout 3800ms; | 89 proxy_next_upstream_timeout 3800ms; |
90 } | 90 } |
91 | 91 |
92 location /timeout/resolver { | 92 location /timeout/resolver { |
93 resolver 127.0.0.1:%%PORT_2_UDP%%; | 93 resolver 127.0.0.1:%%PORT_8082_UDP%%; |
94 | 94 |
95 proxy_pass http://$host:%%PORT_1%%/w2; | 95 proxy_pass http://$host:%%PORT_8081%%/w2; |
96 proxy_next_upstream_timeout 3800ms; | 96 proxy_next_upstream_timeout 3800ms; |
97 } | 97 } |
98 | 98 |
99 location /timeout/zero { | 99 location /timeout/zero { |
100 proxy_pass http://u/w; | 100 proxy_pass http://u/w; |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 EOF | 110 EOF |
111 | 111 |
112 $t->run_daemon(\&http_daemon, port(1)); | 112 $t->run_daemon(\&http_daemon, port(8081)); |
113 $t->run_daemon(\&dns_daemon, port(2), $t); | 113 $t->run_daemon(\&dns_daemon, port(8082), $t); |
114 $t->run(); | 114 $t->run(); |
115 | 115 |
116 $t->waitforsocket('127.0.0.1:' . port(1)); | 116 $t->waitforsocket('127.0.0.1:' . port(8081)); |
117 $t->waitforfile($t->testdir . '/' . port(2)); | 117 $t->waitforfile($t->testdir . '/' . port(8082)); |
118 | 118 |
119 ############################################################################### | 119 ############################################################################### |
120 | 120 |
121 like(http_get('/tries'), qr/x404, 404x/, 'tries'); | 121 like(http_get('/tries'), qr/x404, 404x/, 'tries'); |
122 like(http_get('/tries/backup'), qr/x404, 404x/, 'tries backup'); | 122 like(http_get('/tries/backup'), qr/x404, 404x/, 'tries backup'); |