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:
@@ -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");
|
||||
}
|
||||
Reference in New Issue
Block a user