feat(doos): add container runtime, audit cases, example demo and tests
- New rootless doos container runtime: sandbox, cgroup, network, images, hardening, davmount, CLI plus molo integration - 18 CVE audit reproductions with READMEs and Makefiles - Example DoosDemo routes, IndexCatalog, static assets, spec update - CLI serve on 0.0.0.0:8000, arg parser, dev server improvements - Runtime HTTP fixes, supervisor isolation backend - Tests for doos, example doos routes, CLI serve; suite count 261 to 265
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
// Route: POST /doos/create (idempotent create with options)
|
||||
#include "support/Assert.hpp"
|
||||
#include "support/DoosHome.hpp"
|
||||
|
||||
using namespace molo::example::test;
|
||||
|
||||
int main() {
|
||||
ScratchDoosHome home("create");
|
||||
Fixture f;
|
||||
auto first = f.client->post("/doos/create", "name=app1&size=1g",
|
||||
"application/x-www-form-urlencoded");
|
||||
check(first.status == 200, "status 200");
|
||||
check(contains(first.body, "\"created\":true"), "first create reports created");
|
||||
auto again = f.client->post("/doos/create", "name=app1", "application/x-www-form-urlencoded");
|
||||
check(contains(again.body, "\"created\":false"), "second create is idempotent");
|
||||
auto noname = f.client->post("/doos/create", "size=1g", "application/x-www-form-urlencoded");
|
||||
check(noname.status == 422, "missing name rejected");
|
||||
auto badname = f.client->post("/doos/create", "name=Bad+Name",
|
||||
"application/x-www-form-urlencoded");
|
||||
check(badname.status == 422, "bad name rejected");
|
||||
auto badsize = f.client->post("/doos/create", "name=app2&size=1x",
|
||||
"application/x-www-form-urlencoded");
|
||||
check(badsize.status == 422, "bad size rejected");
|
||||
auto badnet = f.client->post("/doos/create", "name=app2&net=bogus",
|
||||
"application/x-www-form-urlencoded");
|
||||
check(badnet.status == 422, "bad net rejected");
|
||||
auto multi = f.client->post("/doos/create", "size=1x&net=bogus",
|
||||
"application/x-www-form-urlencoded");
|
||||
check(multi.status == 422, "multi-failure is 422");
|
||||
check(contains(multi.body, "name is required"), "all failures listed (name)");
|
||||
check(contains(multi.body, "invalid size"), "all failures listed (size)");
|
||||
return finish("doos/create");
|
||||
}
|
||||
Reference in New Issue
Block a user