|
73 | 73 | "body": name,
|
74 | 74 | }
|
75 | 75 | origin.addResponse("sessionfile.log", request_header, response_header)
|
76 |
| - origin.ReturnCode = Any(0, -2) |
| 76 | + origin.ReturnCode = 0 |
77 | 77 | origins.append(origin)
|
78 | 78 | dns.addRecords(records={name: ["127.0.0.1"]})
|
79 | 79 |
|
80 | 80 | # Define ATS and configure
|
81 | 81 | ts = Test.MakeATSProcess("ts", enable_cache=False)
|
82 |
| -ts.ReturnCode = Any(0, -2) |
| 82 | +ts.ReturnCode = 0 |
83 | 83 | ts.Disk.records_config.update(
|
84 | 84 | {
|
85 | 85 | 'proxy.config.dns.nameservers': f"127.0.0.1:{dns.Variables.Port}",
|
|
103 | 103 | ts.Disk.MakeConfigFile("regex_remap.config").AddLines(
|
104 | 104 | [
|
105 | 105 | "/nh0 http://origin/path @strategy=nh1",
|
106 |
| - "/nh1 http://origin/path @strategy=null", |
| 106 | + '/nh1 http://origin/path @strategy=', |
107 | 107 | "/nh2 http://origin/path @strategy=nh0",
|
108 | 108 | ])
|
109 | 109 | ts.Disk.MakeConfigFile("strat.lua").AddLines(
|
|
113 | 113 | ' if uri:find("nh0") then',
|
114 | 114 | ' ts.http.set_next_hop_strategy("nh1")',
|
115 | 115 | ' elseif uri:find("nh1") then',
|
116 |
| - ' ts.http.clear_next_hop_strategy("nh1")', |
| 116 | + ' ts.http.set_next_hop_strategy("")', |
117 | 117 | ' elseif uri:find("nh2") then',
|
118 | 118 | ' ts.http.set_next_hop_strategy("nh0")',
|
119 | 119 | ' end',
|
|
190 | 190 | ps.StartBefore(dns)
|
191 | 191 | ps.StartBefore(Test.Processes.ts)
|
192 | 192 | tr.MakeCurlCommand(curl_and_args + " http://nh0_hr/path", ts=ts)
|
193 |
| -ps.ReturnCode = Any(0, -2) |
| 193 | +ps.ReturnCode = 0 |
194 | 194 | ps.Streams.stdout.Content = Testers.ContainsExpression("nh0", "expected nh0")
|
195 | 195 | tr.StillRunningAfter = ts
|
196 | 196 | tr.StillRunnerAfter = dns
|
|
199 | 199 | tr = Test.AddTestRun("nh1_hr straight through request")
|
200 | 200 | ps = tr.Processes.Default
|
201 | 201 | tr.MakeCurlCommand(curl_and_args + " http://nh1_hr/path", ts=ts)
|
202 |
| -ps.ReturnCode = Any(0, -2) |
| 202 | +ps.ReturnCode = 0 |
203 | 203 | ps.Streams.stdout.Content = Testers.ContainsExpression("nh1", "expected nh1")
|
204 | 204 | tr.StillRunningAfter = ts
|
205 | 205 |
|
206 | 206 | # 2 - nh2_hr default request
|
207 | 207 | tr = Test.AddTestRun("nh2_hr straight through request")
|
208 | 208 | ps = tr.Processes.Default
|
209 | 209 | tr.MakeCurlCommand(curl_and_args + " http://nh2_hr/path", ts=ts)
|
210 |
| -ps.ReturnCode = Any(0, -2) |
| 210 | +ps.ReturnCode = 0 |
211 | 211 | ps.Streams.stdout.Content = Testers.ContainsExpression("nh2", "expected nh2")
|
212 | 212 | tr.StillRunningAfter = ts
|
213 | 213 |
|
214 | 214 | # 3 switch strategies
|
215 | 215 | tr = Test.AddTestRun("nh0_hr switch to nh1")
|
216 | 216 | ps = tr.Processes.Default
|
217 | 217 | tr.MakeCurlCommand(curl_and_args + ' http://nh0_hr/path -H "Strategy: nh1"', ts=ts)
|
218 |
| -ps.ReturnCode = Any(0, -2) |
| 218 | +ps.ReturnCode = 0 |
219 | 219 | ps.Streams.stdout.Content = Testers.ContainsExpression("nh1", "expected nh1")
|
220 | 220 | tr.StillRunningAfter = ts
|
221 | 221 | tr.StillRunnerAfter = dns
|
|
224 | 224 | tr = Test.AddTestRun("nh1_hr switch to parent.config")
|
225 | 225 | ps = tr.Processes.Default
|
226 | 226 | tr.MakeCurlCommand(curl_and_args + ' http://nh1_hr/path -H "Strategy: null"', ts=ts)
|
227 |
| -ps.ReturnCode = Any(0, -2) |
| 227 | +ps.ReturnCode = 0 |
228 | 228 | ps.Streams.stdout.Content = Testers.ContainsExpression("nh2", "expected nh2")
|
229 | 229 | tr.StillRunningAfter = ts
|
230 | 230 | tr.StillRunnerAfter = dns
|
|
233 | 233 | tr = Test.AddTestRun("nh2_hr switch to nh0")
|
234 | 234 | ps = tr.Processes.Default
|
235 | 235 | tr.MakeCurlCommand(curl_and_args + ' http://nh2_hr/path -H "Strategy: nh0"', ts=ts)
|
236 |
| -ps.ReturnCode = Any(0, -2) |
| 236 | +ps.ReturnCode = 0 |
237 | 237 | ps.Streams.stdout.Content = Testers.ContainsExpression("nh0", "expected nh0")
|
238 | 238 | tr.StillRunningAfter = ts
|
239 | 239 | tr.StillRunnerAfter = dns
|
|
244 | 244 | tr = Test.AddTestRun("nh0_rr switch to nh1")
|
245 | 245 | ps = tr.Processes.Default
|
246 | 246 | tr.MakeCurlCommand(curl_and_args + ' http://nh0_rr/nh0', ts=ts)
|
247 |
| -ps.ReturnCode = Any(0, -2) |
| 247 | +ps.ReturnCode = 0 |
248 | 248 | ps.Streams.stdout.Content = Testers.ContainsExpression("nh1", "expected nh1")
|
249 | 249 | tr.StillRunningAfter = ts
|
250 | 250 | tr.StillRunnerAfter = dns
|
251 | 251 |
|
252 |
| -# 7 strategy to parent.config |
| 252 | +# ' strategy to parent.config |
253 | 253 | tr = Test.AddTestRun("nh1_rr switch to parent.config")
|
254 | 254 | ps = tr.Processes.Default
|
255 | 255 | tr.MakeCurlCommand(curl_and_args + ' http://nh1_rr/nh1', ts=ts)
|
256 |
| -ps.ReturnCode = Any(0, -2) |
| 256 | +ps.ReturnCode = 0 |
257 | 257 | ps.Streams.stdout.Content = Testers.ContainsExpression("nh2", "expected nh2")
|
258 | 258 | tr.StillRunningAfter = ts
|
259 | 259 | tr.StillRunnerAfter = dns
|
|
262 | 262 | tr = Test.AddTestRun("nh2_rr switch to nh0")
|
263 | 263 | ps = tr.Processes.Default
|
264 | 264 | tr.MakeCurlCommand(curl_and_args + ' http://nh2_rr/nh2', ts=ts)
|
265 |
| -ps.ReturnCode = Any(0, -2) |
| 265 | +ps.ReturnCode = 0 |
266 | 266 | ps.Streams.stdout.Content = Testers.ContainsExpression("nh0", "expected nh0")
|
267 | 267 | tr.StillRunningAfter = ts
|
268 | 268 | tr.StillRunnerAfter = dns
|
|
273 | 273 | tr = Test.AddTestRun("nh0_lua switch to nh1")
|
274 | 274 | ps = tr.Processes.Default
|
275 | 275 | tr.MakeCurlCommand(curl_and_args + ' http://nh0_lua/nh0', ts=ts)
|
276 |
| -ps.ReturnCode = Any(0, -2) |
| 276 | +ps.ReturnCode = 0 |
277 | 277 | ps.Streams.stdout.Content = Testers.ContainsExpression("nh1", "expected nh1")
|
278 | 278 | tr.StillRunningAfter = ts
|
279 | 279 | tr.StillRunnerAfter = dns
|
|
282 | 282 | tr = Test.AddTestRun("nh1_lua switch to parent.config")
|
283 | 283 | ps = tr.Processes.Default
|
284 | 284 | tr.MakeCurlCommand(curl_and_args + ' http://nh1_lua/nh1', ts=ts)
|
285 |
| -ps.ReturnCode = Any(0, -2) |
| 285 | +ps.ReturnCode = 0 |
286 | 286 | ps.Streams.stdout.Content = Testers.ContainsExpression("nh2", "expected nh2")
|
287 | 287 | tr.StillRunningAfter = ts
|
288 | 288 | tr.StillRunnerAfter = dns
|
|
291 | 291 | tr = Test.AddTestRun("nh2_lua switch to nh0")
|
292 | 292 | ps = tr.Processes.Default
|
293 | 293 | tr.MakeCurlCommand(curl_and_args + ' http://nh2_lua/nh2', ts=ts)
|
294 |
| -ps.ReturnCode = Any(0, -2) |
| 294 | +ps.ReturnCode = 0 |
295 | 295 | ps.Streams.stdout.Content = Testers.ContainsExpression("nh0", "expected nh0")
|
296 | 296 | tr.StillRunningAfter = ts
|
297 | 297 | tr.StillRunnerAfter = dns
|
0 commit comments