test: retry transient doc gate reads

This commit is contained in:
udo
2026-07-14 04:34:52 +00:00
parent 2a1400b78c
commit afb17fc334
2 changed files with 29 additions and 18 deletions
+26 -17
View File
@@ -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));
}