feat(workflow): example covers security, platform, enterprise and resilience features

105 route tests, matrix crawl, spec and README updated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 02:19:52 +02:00
co-authored by Claude Sonnet 5.5
parent 00af65613d
commit 62fdd08da8
90 changed files with 8038 additions and 11 deletions
+24
View File
@@ -0,0 +1,24 @@
// Route: /clients/retry (capped backoff, 4xx never retried)
#include "support/Assert.hpp"
using namespace molo::example::test;
using molo::example::fw::Method;
static const char* kForm = "application/x-www-form-urlencoded";
int main() {
Fixture f;
check(f.client->get("/clients/retry").status == 200, "status 200");
auto ok = f.client->post("/clients/retry/run", "failures=2&max_attempts=3&status=503", kForm);
check(contains(ok.body, "final status 200 after 3 attempt(s)"), "succeeds on third attempt");
check(contains(ok.body, "backoff 100ms") && contains(ok.body, "backoff 200ms"), "doubling backoff");
auto cap = f.client->post("/clients/retry/run", "failures=10&max_attempts=5&status=503", kForm);
check(contains(cap.body, "final status 503 after 5 attempt(s)"), "gives up at the attempt cap");
check(contains(cap.body, "backoff 800ms"), "backoff capped at 800ms");
auto c4 = f.client->post("/clients/retry/run", "failures=3&max_attempts=5&status=404", kForm);
check(contains(c4.body, "after 1 attempt(s)"), "404 is not retried");
auto bad = f.client->post("/clients/retry/run", "failures=1&max_attempts=9&status=200", kForm);
check(bad.status == 422 && contains(bad.body, "must be between 1 and 5"), "422 attempts above hard cap");
check(contains(f.client->get("/clients/retry").body, "runs"), "side effect: runs counted");
return finish("clients/retry");
}
+27
View File
@@ -0,0 +1,27 @@
// Route: /clients/session (cookie jar, pool, proxy, auth)
#include "support/Assert.hpp"
using namespace molo::example::test;
using molo::example::fw::Method;
static const char* kForm = "application/x-www-form-urlencoded";
int main() {
Fixture f;
check(f.client->get("/clients/session").status == 200, "status 200");
auto r1 = f.client->post("/clients/session/request", "auth=basic", kForm);
check(contains(r1.body, "Authorization=Basic ZGVtbzpkZW1v"), "basic auth header");
check(!contains(r1.body, "Cookie="), "first request has no cookie");
auto r2 = f.client->post("/clients/session/request", "auth=bearer", kForm);
check(contains(r2.body, "Cookie=sid=s-1; visits=1"), "cookie jar replays server cookies");
check(contains(r2.body, "Bearer demo-token"), "bearer header");
check(contains(r2.body, "connection reused"), "pooled connection reused");
auto r3 = f.client->post("/clients/session/request", "proxy=http://proxy.local:3128", kForm);
check(contains(r3.body, "connection created via http://proxy.local:3128"), "proxy change opens new connection");
auto bad = f.client->post("/clients/session/request", "proxy=ftp://x", kForm);
check(bad.status == 422 && contains(bad.body, "socks5://host:port"), "422 bad proxy");
auto badauth = f.client->post("/clients/session/request", "auth=digest", kForm);
check(badauth.status == 422, "422 unknown auth");
check(contains(f.client->get("/clients/session").body, "pool_created"), "side effect: pool stats shown");
return finish("clients/session");
}