test: retry transient doc gate reads
This commit is contained in:
+26
-17
@@ -214,27 +214,36 @@ void cli_run_doc_pages_gate()
|
||||
continue;
|
||||
bool has_example = cli_doc_source_has_example(source);
|
||||
String path = "/doc/index.uce?p=" + uri_encode(page);
|
||||
CliHttpResponse res = cli_frontend(path);
|
||||
CliHttpResponse res;
|
||||
String summary;
|
||||
bool ok = cli_expect_http_once(res, path, 200, "doc-detail", error_markers, summary);
|
||||
String lower = to_lower(res.body);
|
||||
if(has_example)
|
||||
bool ok = false;
|
||||
for(u64 attempt = 0; attempt < 3; attempt++)
|
||||
{
|
||||
if(!cli_contains(res.body, "class=\"example-output\"") || !cli_contains(res.body, "example-output-label\">Output"))
|
||||
if(attempt > 0)
|
||||
usleep(500000);
|
||||
res = cli_frontend(path);
|
||||
ok = cli_expect_http_once(res, path, 200, "doc-detail", error_markers, summary);
|
||||
String lower = to_lower(res.body);
|
||||
if(has_example)
|
||||
{
|
||||
ok = false;
|
||||
summary += "; missing example Output block";
|
||||
}
|
||||
if(cli_contains(lower, "doc example error"))
|
||||
{
|
||||
ok = false;
|
||||
summary += "; example reported an error";
|
||||
}
|
||||
if(cli_doc_example_is_placeholder(source))
|
||||
{
|
||||
ok = false;
|
||||
summary += "; placeholder example (must exercise the API)";
|
||||
if(!cli_contains(res.body, "class=\"example-output\"") || !cli_contains(res.body, "example-output-label\">Output"))
|
||||
{
|
||||
ok = false;
|
||||
summary += "; missing example Output block";
|
||||
}
|
||||
if(cli_contains(lower, "doc example error"))
|
||||
{
|
||||
ok = false;
|
||||
summary += "; example reported an error";
|
||||
}
|
||||
if(cli_doc_example_is_placeholder(source))
|
||||
{
|
||||
ok = false;
|
||||
summary += "; placeholder example (must exercise the API)";
|
||||
}
|
||||
}
|
||||
if(ok)
|
||||
break;
|
||||
}
|
||||
cli_test_case("uce_doc_gate:doc page " + page, ok, ok ? summary : summary + "; body=" + cli_truncate(res.body));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user