Mercurial > hg > nginx-tests
comparison proxy_next_upstream.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 | da1325cb1c39 |
comparison
equal
deleted
inserted
replaced
973:7d7aef8b9f3a | 974:882267679006 |
---|---|
34 | 34 |
35 http { | 35 http { |
36 %%TEST_GLOBALS_HTTP%% | 36 %%TEST_GLOBALS_HTTP%% |
37 | 37 |
38 upstream u { | 38 upstream u { |
39 server 127.0.0.1:%%PORT_1%%; | 39 server 127.0.0.1:8081; |
40 server 127.0.0.1:%%PORT_2%%; | 40 server 127.0.0.1:8082; |
41 } | 41 } |
42 | 42 |
43 upstream u2 { | 43 upstream u2 { |
44 server 127.0.0.1:%%PORT_1%%; | 44 server 127.0.0.1:8081; |
45 server 127.0.0.1:%%PORT_2%%; | 45 server 127.0.0.1:8082; |
46 } | 46 } |
47 | 47 |
48 server { | 48 server { |
49 listen 127.0.0.1:%%PORT_0%%; | 49 listen 127.0.0.1:8080; |
50 server_name localhost; | 50 server_name localhost; |
51 | 51 |
52 location / { | 52 location / { |
53 proxy_pass http://u; | 53 proxy_pass http://u; |
54 proxy_next_upstream http_500 http_404; | 54 proxy_next_upstream http_500 http_404; |
65 return 200 "$upstream_addr\n"; | 65 return 200 "$upstream_addr\n"; |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 server { | 69 server { |
70 listen 127.0.0.1:%%PORT_1%%; | 70 listen 127.0.0.1:8081; |
71 server_name localhost; | 71 server_name localhost; |
72 | 72 |
73 location / { | 73 location / { |
74 return 404; | 74 return 404; |
75 } | 75 } |
84 return 404; | 84 return 404; |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 server { | 88 server { |
89 listen 127.0.0.1:%%PORT_2%%; | 89 listen 127.0.0.1:8082; |
90 server_name localhost; | 90 server_name localhost; |
91 | 91 |
92 location / { | 92 location / { |
93 return 200 "TEST-OK-IF-YOU-SEE-THIS\n"; | 93 return 200 "TEST-OK-IF-YOU-SEE-THIS\n"; |
94 } | 94 } |
103 | 103 |
104 $t->run(); | 104 $t->run(); |
105 | 105 |
106 ############################################################################### | 106 ############################################################################### |
107 | 107 |
108 my ($p1, $p2) = (port(1), port(2)); | 108 my ($p1, $p2) = (port(8081), port(8082)); |
109 | 109 |
110 # check if both request fallback to a backend | 110 # check if both request fallback to a backend |
111 # which returns valid response | 111 # which returns valid response |
112 | 112 |
113 like(http_get('/'), qr/SEE-THIS/, 'proxy request'); | 113 like(http_get('/'), qr/SEE-THIS/, 'proxy request'); |