2026-10-24 04:42:00 +02:00
|
|
|
// Route: GET /agent/registry (page; never calls Google)
|
|
|
|
|
#include "support/GoogleRig.hpp"
|
|
|
|
|
#include <cstdlib>
|
|
|
|
|
|
|
|
|
|
using namespace molo::example::test;
|
|
|
|
|
using molo::example::fw::Method;
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
setenv("GOOGLE_CLOUD_PROJECT", "test-project", 1);
|
|
|
|
|
GoogleRig rig(false);
|
|
|
|
|
Fixture f(rig.client);
|
|
|
|
|
auto res = f.client->get("/agent/registry");
|
|
|
|
|
check(res.status == 200, "status 200 without a credential");
|
|
|
|
|
check(contains(res.headers.get("Content-Type"), "text/html"), "html");
|
|
|
|
|
check(contains(res.body, "Agent registry") && contains(res.body, "agent_registry.js"), "page and script");
|
2026-10-24 05:43:13 +02:00
|
|
|
check(contains(res.body, "id=\"r-truncated\""), "page has the loud truncation banner");
|
|
|
|
|
check(contains(res.body, "id=\"r-version\"") && contains(res.body, "v1alpha"), "page offers v1alpha");
|
|
|
|
|
check(contains(res.body, "ops-gateways"), "page offers the operations lists");
|
2026-10-24 04:42:00 +02:00
|
|
|
check(f.client->post("/agent/registry").status == 405, "post is 405");
|
|
|
|
|
check(f.client->get("/agent/registry/nope").status == 404, "unknown sub route is 404");
|
|
|
|
|
check(rig.mock->send_count() == 0, "side effect: no upstream traffic");
|
|
|
|
|
return finish("agent/registry");
|
|
|
|
|
}
|