test: include response tails in site failures
This commit is contained in:
parent
41b034739b
commit
30fcfce103
@ -23,6 +23,13 @@ String cli_truncate(String value, u64 max_len = 240)
|
||||
return(value.substr(0, max_len) + "...");
|
||||
}
|
||||
|
||||
String cli_tail(String value, u64 max_len = 500)
|
||||
{
|
||||
if(value.length() <= max_len)
|
||||
return(value);
|
||||
return("..." + value.substr(value.length() - max_len));
|
||||
}
|
||||
|
||||
CliHttpResponse cli_http_request(String host, u16 port, String path, String extra_headers = "")
|
||||
{
|
||||
CliHttpResponse res;
|
||||
@ -298,7 +305,7 @@ void cli_run_site_suite()
|
||||
break;
|
||||
}
|
||||
String name = "uce_site_suite:site tests " + (file == "index.uce" ? "index" : file == "io.uce" ? "filesystem" : file == "websockets.ws.uce" ? "websockets page" : replace(replace(replace(file, ".uce", ""), ".ws", ""), "_", " "));
|
||||
String fail_detail = "; status=" + std::to_string(res.status) + "; expected_marker=" + (cli_contains(res.body, expected) ? "yes" : "no") + "; summary=" + (cli_contains(lower, "<div class=\"tests-summary\">") ? "yes" : "no") + "; failed_zero=" + (cli_contains(lower, ">failed 0</span>") ? "yes" : "no") + "; reports_failure=" + (cli_site_body_reports_failure(lower) ? "yes" : "no") + "; body=" + cli_truncate(res.body);
|
||||
String fail_detail = "; status=" + std::to_string(res.status) + "; expected_marker=" + (cli_contains(res.body, expected) ? "yes" : "no") + "; summary=" + (cli_contains(lower, "<div class=\"tests-summary\">") ? "yes" : "no") + "; failed_zero=" + (cli_contains(lower, ">failed 0</span>") ? "yes" : "no") + "; reports_failure=" + (cli_site_body_reports_failure(lower) ? "yes" : "no") + "; body=" + cli_truncate(res.body) + "; tail=" + cli_tail(res.body);
|
||||
cli_test_case(name, ok, (ok ? "HTTP 200 with suite page marker and no failed cases for /tests/" : "site suite failed for /tests/") + file + (ok ? "" : fail_detail));
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user