Skip to content

Commit 71ef74f

Browse files
committed
tests: t/sanity.t: made tests more resilient to potential CDN changes.
1 parent 58ed89b commit 71ef74f

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

t/sanity.t

+14-12
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ done
105105
}
106106
--- request
107107
GET /t
108-
--- response_body
109-
foo.com:1234: [{"addr":"127.0.0.1:80","fail_timeout":53,"max_fails":100,"name":"127.0.0.1","weight":4},{"addr":"138.68.231.133:81","backup":true,"fail_timeout":10,"max_fails":1,"name":"agentzh.org:81","weight":1}]
110-
bar: [{"addr":"127.0.0.2:80","fail_timeout":10,"max_fails":1,"name":"127.0.0.2","weight":1}]
108+
--- response_body_like chomp
109+
\Afoo\.com:1234: \[\{"addr":"127\.0\.0\.1:80","fail_timeout":53,"max_fails":100,"name":"127\.0\.0\.1","weight":4\},\{"addr":(?:\[?"\d+\.\d+\.\d+\.\d+:81",?\]?)+,"backup":true,"fail_timeout":10,"max_fails":1,"name":"agentzh\.org:81","weight":1\}\]
110+
bar: \[\{"addr":"127\.0\.0\.2:80","fail_timeout":10,"max_fails":1,"name":"127\.0\.0\.2","weight":1\}\]
111111
failed to get servers: upstream not found
112-
112+
\z
113113
--- no_error_log
114114
[error]
115115
@@ -173,12 +173,13 @@ failed to get servers: upstream not found
173173
}
174174
--- request
175175
GET /upstreams
176-
--- response_body
177-
upstream foo.com:
178-
addr = 127.0.0.1:80, fail_timeout = 53, max_fails = 100, name = 127.0.0.1, weight = 4
179-
addr = 138.68.231.133:81, fail_timeout = 10, max_fails = 1, name = agentzh.org:81, weight = 1
176+
--- response_body_like chomp
177+
\Aupstream foo\.com:
178+
addr = 127\.0\.0\.1:80, fail_timeout = 53, max_fails = 100, name = 127\.0\.0\.1, weight = 4
179+
addr = \{?(?:\d+\.\d+\.\d+\.\d+:81(?:,\s)?)+\}?, fail_timeout = 10, max_fails = 1, name = agentzh\.org:81, weight = 1
180180
upstream bar:
181-
addr = 127.0.0.2:80, fail_timeout = 10, max_fails = 1, name = 127.0.0.2, weight = 1
181+
addr = 127\.0\.0\.2:80, fail_timeout = 10, max_fails = 1, name = 127\.0\.0\.2, weight = 1
182+
\z
182183
--- no_error_log
183184
[error]
184185
@@ -274,9 +275,10 @@ upstream bar:
274275
}
275276
--- request
276277
GET /t
277-
--- response_body
278-
[{"conns":0,"current_weight":0,"effective_weight":4,"fail_timeout":53,"fails":0,"id":0,"max_fails":100,"name":"127.0.0.1:80","weight":4},{"conns":0,"current_weight":0,"effective_weight":1,"fail_timeout":10,"fails":0,"id":1,"max_fails":1,"name":"138.68.231.133:81","weight":1}]
279-
[{"conns":0,"current_weight":0,"effective_weight":1,"fail_timeout":10,"fails":0,"id":0,"max_fails":1,"name":"127.0.0.2:80","weight":1}]
278+
--- response_body_like chomp
279+
\A\[\{"conns":0,"current_weight":0,"effective_weight":4,"fail_timeout":53,"fails":0,"id":0,"max_fails":100,"name":"127\.0\.0\.1:80","weight":4\},(?:\{"conns":0,"current_weight":0,"effective_weight":1,"fail_timeout":10,"fails":0,"id":\d+,"max_fails":1,"name":"\d+\.\d+\.\d+\.\d+:81","weight":1\},?)+\]
280+
\[\{"conns":0,"current_weight":0,"effective_weight":1,"fail_timeout":10,"fails":0,"id":0,"max_fails":1,"name":"127\.0\.0\.2:80","weight":1\}\]
281+
\z
280282
--- no_error_log
281283
[error]
282284

0 commit comments

Comments
 (0)