- 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
30 lines
1.5 KiB
C++
30 lines
1.5 KiB
C++
// Route: POST /doos/delete (dry run unless confirm=yes)
|
|
#include "support/Assert.hpp"
|
|
#include "support/DoosHome.hpp"
|
|
|
|
using namespace molo::example::test;
|
|
|
|
int main() {
|
|
ScratchDoosHome home("delete");
|
|
Fixture f;
|
|
auto made = f.client->post("/doos/create", "name=temp1", "application/x-www-form-urlencoded");
|
|
check(made.status == 200, "create 200");
|
|
auto dry = f.client->post("/doos/delete", "name=temp1", "application/x-www-form-urlencoded");
|
|
check(dry.status == 200, "dry run 200");
|
|
check(contains(dry.body, "\"dry_run\":true"), "dry run without confirm");
|
|
check(contains(dry.body, "dry run"), "report text");
|
|
auto still = f.client->get("/doos/status");
|
|
check(contains(still.body, "\"name\":\"temp1\""), "dry run deletes nothing");
|
|
auto gone = f.client->post("/doos/delete", "name=temp1&confirm=yes",
|
|
"application/x-www-form-urlencoded");
|
|
check(contains(gone.body, "\"dry_run\":false"), "confirm deletes");
|
|
auto after = f.client->get("/doos/status");
|
|
check(!contains(after.body, "\"name\":\"temp1\""), "container gone after confirm");
|
|
auto missing = f.client->post("/doos/delete", "name=temp1&confirm=yes",
|
|
"application/x-www-form-urlencoded");
|
|
check(missing.status == 404, "missing container is 404");
|
|
auto noname = f.client->post("/doos/delete", "confirm=yes", "application/x-www-form-urlencoded");
|
|
check(noname.status == 422, "missing name rejected");
|
|
return finish("doos/delete");
|
|
}
|