Skip to content

Commit

Permalink
tests(*) increase robustness of httpbin-reliant tests
Browse files Browse the repository at this point in the history
We sometimes get a real 503 from httpbin.org as well. The tests still
succeed in case of upstream errors.
  • Loading branch information
thibaultcha committed Nov 26, 2024
1 parent 9136e46 commit d834bb0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
5 changes: 3 additions & 2 deletions t/03-proxy_wasm/hfuncs/130-proxy_dispatch_http.t
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ Needs IPv4 resolution + external I/O to succeed.
Succeeds on:
- HTTP 200 (httpbin.org/headers success)
- HTTP 502 (httpbin.org Bad Gateway)
- HTTP 503 (httpbin.org Service Temporarily Unavailable)
- HTTP 504 (httpbin.org Gateway timeout)
--- skip_eval: 5: $::osname =~ m/darwin/
--- valgrind
Expand All @@ -428,11 +429,11 @@ qq{
echo fail;
}
}
--- error_code_like: (200|502|504)
--- error_code_like: (200|502|503|504)
--- response_body_like
(\s*"Hello": "world",\s*
.*?
\s*"X-Thing": "foo,bar"\s*|.*?502 Bad Gateway.*|.*?504 Gateway Time-out.*)
\s*"X-Thing": "foo,bar"\s*|.*?502 Bad Gateway.*|.*?503 Service Temporarily Unavailable.*|.*?504 Gateway Time-out.*)
--- no_error_log
[error]
[crit]
Expand Down
10 changes: 6 additions & 4 deletions t/04-openresty/lua-bridge/002-proxy_wasm_lua_resolver_sanity.t
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ __DATA__
Succeeds on:
- HTTP 200 (httpbin.org/headers success)
- HTTP 502 (httpbin.org Bad Gateway)
- HTTP 503 (httpbin.org Service Temporarily Unavailable)
- HTTP 504 (httpbin.org Gateway timeout)
--- skip_no_debug
--- timeout eval: $::ExtTimeout
Expand All @@ -33,8 +34,8 @@ Succeeds on:
on_http_call_response=echo_response_body';
echo failed;
}
--- error_code_like: (200|502|504)
--- response_body_like: ("Host": "httpbin\.org"|.*?502 Bad Gateway.*|.*?504 Gateway Time-out.*)
--- error_code_like: (200|502|503|504)
--- response_body_like: ("Host": "httpbin\.org"|.*?502 Bad Gateway.*|.*?503 Service Temporarily Unavailable.*|.*?504 Gateway Time-out.*)
--- error_log eval
[
qr/\[debug\] .*? wasm lua resolver thread/,
Expand Down Expand Up @@ -291,6 +292,7 @@ Needs IPv4 resolution + external I/O to succeed.
Succeeds on:
- HTTP 200 (httpbin.org/headers success)
- HTTP 502 (httpbin.org Bad Gateway)
- HTTP 503 (httpbin.org Service Temporarily Unavailable)
- HTTP 504 (httpbin.org Gateway timeout)
--- skip_eval: 5: $t::TestWasmX::nginxV !~ m/--with-debug/ || defined $ENV{GITHUB_ACTIONS}
--- skip_no_debug
Expand All @@ -307,8 +309,8 @@ Succeeds on:
on_http_call_response=echo_response_body';
echo failed;
}
--- error_code_like: (200|502|504)
--- response_body_like: ("Host": "httpbin\.org"|.*?502 Bad Gateway.*|.*?504 Gateway Time-out.*)
--- error_code_like: (200|502|503|504)
--- response_body_like: ("Host": "httpbin\.org"|.*?502 Bad Gateway.*|.*?503 Service Temporarily Unavailable.*|.*?504 Gateway Time-out.*)
--- error_log eval
[
qr/\[debug\] .*? wasm lua resolver creating new dns_client/,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ __DATA__
Succeeds on:
- HTTP 200 (httpbin.org/headers success)
- HTTP 502 (httpbin.org Bad Gateway)
- HTTP 503 (httpbin.org Service Temporarily Unavailable)
- HTTP 504 (httpbin.org Gateway timeout)
--- skip_no_debug
--- timeout eval: $::ExtTimeout
Expand All @@ -40,8 +41,8 @@ Succeeds on:
on_http_call_response=echo_response_body';
echo failed;
}
--- error_code_like: (200|502|504)
--- response_body_like: ("Host": "httpbin\.org"|.*?502 Bad Gateway.*|.*?504 Gateway Time-out.*)
--- error_code_like: (200|502|503|504)
--- response_body_like: ("Host": "httpbin\.org"|.*?502 Bad Gateway.*|.*?503 Service Temporarily Unavailable.*|.*?504 Gateway Time-out.*)
--- error_log eval
[
qr/\[debug\] .*? wasm lua resolver thread/,
Expand Down

0 comments on commit d834bb0

Please sign in to comment.