Files
moloapp/tests/example/operability/bulkhead_test.cpp
T
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

25 lines
1.2 KiB
C++

// Route: /operability/bulkhead (2 slots, queue of 1, then reject)
#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/bulkhead").status == 200, "status 200");
auto a = f.client->post("/operability/bulkhead/acquire", "", kForm);
check(contains(a.body, ">admitted<") || contains(a.body, "admitted"), "first admitted");
f.client->post("/operability/bulkhead/acquire", "", kForm);
auto q = f.client->post("/operability/bulkhead/acquire", "", kForm);
check(contains(q.body, "queued"), "third queued");
auto r = f.client->post("/operability/bulkhead/acquire", "", kForm);
check(contains(r.body, "rejected: compartment full"), "fourth rejected (limit)");
check(contains(r.body, "2/2"), "side effect: active slots full");
check(f.client->post("/operability/bulkhead/nope", "", kForm).status == 404, "404 unknown action");
for (int i = 0; i < 3; ++i) f.client->post("/operability/bulkhead/release", "", kForm);
check(contains(f.client->post("/operability/bulkhead/release", "", kForm).body, "nothing to release"), "empty release is reported");
return finish("operability/bulkhead");
}