test: stabilize cold local service probes
This commit is contained in:
parent
9e70dde366
commit
a0d085859c
@ -262,7 +262,7 @@ void cli_run_http_smoke()
|
||||
|
||||
bool cli_site_body_reports_failure(String lower)
|
||||
{
|
||||
if(cli_contains(lower, "status-badge status-error\">fail</span>"))
|
||||
if(cli_contains(lower, ">fail</span>"))
|
||||
return(true);
|
||||
for(String digit : split("1 2 3 4 5 6 7 8 9", " "))
|
||||
if(cli_contains(lower, ">failed " + digit))
|
||||
|
||||
@ -66,10 +66,20 @@ RENDER(Request& context)
|
||||
http_req["method"] = "GET";
|
||||
http_req["url"] = "http://127.0.0.1/tests/security_headers.uce";
|
||||
http_req["headers"]["Host"] = "uce.openfu.com";
|
||||
http_req["timeout_ms"] = (f64)500;
|
||||
DValue http_res = http_request(http_req);
|
||||
u64 http_job = http_request_async(http_req);
|
||||
DValue http_async = job_await(http_job, 1500);
|
||||
http_req["timeout_ms"] = (f64)2000;
|
||||
DValue http_res;
|
||||
DValue http_async;
|
||||
u64 http_job = 0;
|
||||
for(u64 attempt = 0; attempt < 3; attempt++)
|
||||
{
|
||||
if(attempt > 0)
|
||||
usleep(250000);
|
||||
http_res = http_request(http_req);
|
||||
http_job = http_request_async(http_req);
|
||||
http_async = job_await(http_job, 3000);
|
||||
if(http_res["status"].to_u64() == 500 && http_async["done"].to_bool() && http_async["result"]["status"].to_u64() == 500)
|
||||
break;
|
||||
}
|
||||
check("http_request() / http_request_async()", http_res["status"].to_u64() == 500 && contains(http_res["body"].to_string(), "security header sanitizer test") && http_job > 0 && http_async["done"].to_bool() && http_async["result"]["status"].to_u64() == 500, json_encode(http_res) + " async=" + json_encode(http_async));
|
||||
|
||||
String auto_lock_file = "/tmp/uce-site-tests-auto-lock.txt";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user