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,22 @@
|
||||
// Route: /data/singleflight (concurrent loads collapse into one)
|
||||
#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("/data/singleflight").status == 200, "status 200");
|
||||
auto res = f.client->post("/data/singleflight/run", "callers=8", kForm);
|
||||
check(contains(res.body, "8 callers, 1 load(s)"), "eight callers share one load");
|
||||
auto one = f.client->post("/data/singleflight/run", "callers=1", kForm);
|
||||
check(contains(one.body, "1 callers, 1 load(s)"), "single caller loads once");
|
||||
auto max = f.client->post("/data/singleflight/run", "callers=16", kForm);
|
||||
check(contains(max.body, "16 callers, 1 load(s)"), "cap of 16 threads still collapses");
|
||||
auto bad = f.client->post("/data/singleflight/run", "callers=17", kForm);
|
||||
check(bad.status == 422 && contains(bad.body, "must be between 1 and 16"), "422 above thread cap");
|
||||
check(contains(f.client->get("/data/singleflight").body, ">3<"), "side effect: three runs counted");
|
||||
return finish("data/singleflight");
|
||||
}
|
||||
Reference in New Issue
Block a user