Files
retoorandClaude Sonnet 5.5 62fdd08da8 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>
2026-10-24 02:19:52 +02:00

23 lines
1.2 KiB
C++

// Route: /operability/chaos (dry run default, hard blast radius)
#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("/operability/chaos").status == 200, "status 200");
auto dry = f.client->post("/operability/chaos/run", "percent=40&max_faults=3", kForm);
check(contains(dry.body, "dry run: 0 injected, 3 planned"), "default is a dry run");
auto armed = f.client->post("/operability/chaos/run", "percent=40&max_faults=2&armed=1", kForm);
check(contains(armed.body, "armed: 2 injected, 2 planned"), "armed run capped at max_faults");
auto big = f.client->post("/operability/chaos/run", "percent=90&max_faults=9", kForm);
check(big.status == 422 && contains(big.body, "must be between 0 and 50"), "percent above cap rejected");
check(contains(big.body, "must be between 1 and 5"), "faults above cap rejected");
check(contains(f.client->get("/operability/chaos").body, "total_injected"), "side effect: totals tracked");
check(contains(f.client->get("/operability/chaos").body, ">2<"), "only the armed run injected");
return finish("operability/chaos");
}