Files
moloapp/tests/example/agent/runtime/status_test.cpp
T

25 lines
1.1 KiB
C++

// Route: GET /agent/runtime/status and /agent/runtime/calls
#include "support/GoogleRig.hpp"
using namespace molo::example::test;
int main() {
setenv("GOOGLE_CLOUD_PROJECT", "test-project", 1);
GoogleRig off(false);
Fixture f(off.client);
auto res = f.client->get("/agent/runtime/status");
check(res.status == 200, "status 200");
check(contains(res.body, "\"configured\":false"), "reports no credential");
check(contains(res.body, "\"project_set\":true"), "project read from env");
auto calls = f.client->get("/agent/runtime/calls");
check(calls.status == 200, "calls 200");
check(contains(calls.body, "aiplatform.projects.locations.reasoningEngines.streamQuery"), "table lists streamQuery");
check(contains(calls.body, "v1beta1/{+name}:query"), "table lists runtime revision query");
GoogleRig on;
Fixture g(on.client);
check(contains(g.client->get("/agent/runtime/status").body, "\"configured\":true"), "reports credential");
check(f.client->post("/agent/runtime/status", "{}", "application/json").status == 405, "post is 405");
check(on.mock->send_count() == 0, "no network");
return finish("agent/runtime/status");
}