feat(clients): models+runtime: close gaps (all Discovery methods wrapped, live re-verification)
models: EndpointAdmin and PublisherAdmin wrap every remaining method of the owned resources (84 call table rows, 132 Discovery methods covered, v1beta1 twins, IAM, operations, responses, export, config, enableModel); planner rejects undeclared body keys; VertexModel::TurnBuilder replays model turns with every thoughtSignature; Lyria WAV mime from bytes; veo-3.1 default. runtime: v1beta1 feedbackEntries, A2A gateway (40 rpcs), a2aTasks, task store records, scoped operations, beta twin flag (103 rows, 214 methods covered); checker verifies twins, a2aEndpoint patterns and coverage. example: admin routes for both parts. SPECs: live results moved from Unverified to Verified live (Veo, Lyria, thought signatures, v1beta1 routes). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,320 @@
|
||||
// Agent Runtime, closed gaps: v1beta1 feedbackEntries, A2A gateway, a2aTasks,
|
||||
// task store records, scoped operations, the beta twin. Deterministic and
|
||||
// local: request construction against the call table (checked against
|
||||
// Discovery by src/google/runtime/tools/check_discovery.py), validation,
|
||||
// caps, confirm gates, no-credential behavior. No Google replies are scripted.
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
||||
#include "clients/transports/mock_transport.h"
|
||||
#include "framework.h"
|
||||
#include "google/credentials.h"
|
||||
#include "google/runtime/a2a.h"
|
||||
#include "google/runtime/agent_runtime.h"
|
||||
#include "google/runtime/calls.h"
|
||||
#include "google/runtime/feedback.h"
|
||||
#include "google/runtime/operation_calls.h"
|
||||
|
||||
using namespace molo::google;
|
||||
using namespace molo::google::runtime;
|
||||
using molo::clients::body::Json;
|
||||
using molo::clients::transports::MockTransport;
|
||||
|
||||
namespace {
|
||||
|
||||
struct Rig {
|
||||
MockTransport* mock = nullptr;
|
||||
std::shared_ptr<GoogleClient> client;
|
||||
CloudContext ctx;
|
||||
explicit Rig(bool configured = false) {
|
||||
auto t = std::make_unique<MockTransport>();
|
||||
mock = t.get();
|
||||
client = std::make_shared<GoogleClient>(std::move(t),
|
||||
configured ? Credentials::bearer("tok") : nullptr);
|
||||
ctx.project = "p1";
|
||||
ctx.location = "us-central1";
|
||||
}
|
||||
};
|
||||
|
||||
// True when validation rejects the call; false when it reached the
|
||||
// credential check (valid input) or did anything else.
|
||||
template <typename F>
|
||||
bool invalid(F&& f) {
|
||||
try {
|
||||
f();
|
||||
} catch (const NotConfiguredError&) {
|
||||
return false;
|
||||
} catch (const GoogleError& e) {
|
||||
return e.http_status() == 400 && e.status() == "INVALID_ARGUMENT";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
bool reaches_credential_check(F&& f) {
|
||||
try {
|
||||
f();
|
||||
} catch (const NotConfiguredError&) {
|
||||
return true;
|
||||
} catch (...) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::string kEngine = "projects/p1/locations/us-central1/reasoningEngines/e1";
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST(runtime_gaps, every_enum_value_has_exactly_one_row) {
|
||||
std::set<int> seen;
|
||||
for (std::size_t i = 0; i < call_count(); ++i) {
|
||||
const CallSpec& s = spec_at(i);
|
||||
ASSERT_TRUE(seen.insert(static_cast<int>(s.call)).second);
|
||||
ASSERT_TRUE(std::string(s.rpc_id).rfind("aiplatform.projects.locations.", 0) == 0);
|
||||
std::string v = s.version;
|
||||
ASSERT_TRUE(v == "v1" || v == "v1beta1");
|
||||
ASSERT_TRUE(std::string(s.path).rfind(v + "/", 0) == 0);
|
||||
}
|
||||
ASSERT_TRUE(call_count() >= 103);
|
||||
for (int c = static_cast<int>(Call::kCreate); c <= static_cast<int>(Call::kTaskRecordEventsList); ++c)
|
||||
ASSERT_EQ(static_cast<int>(spec_of(static_cast<Call>(c)).call), c);
|
||||
ASSERT_EQ(seen.size(), call_count());
|
||||
}
|
||||
|
||||
TEST(runtime_gaps, every_row_renders_a_concrete_path) {
|
||||
for (std::size_t i = 0; i < call_count(); ++i) {
|
||||
const CallSpec& s = spec_at(i);
|
||||
std::string path = render(s.call, kEngine, "card");
|
||||
ASSERT_TRUE(path.find('{') == std::string::npos);
|
||||
ASSERT_TRUE(path.rfind("/projects/", 0) == 0);
|
||||
}
|
||||
ASSERT_THROW(render(Call::kA2aEngineCard, kEngine, "../x"), GoogleError);
|
||||
ASSERT_THROW(render(Call::kA2aEngineCard, kEngine, ""), GoogleError);
|
||||
ASSERT_THROW(render(Call::kA2aEngineCard, kEngine, "a b"), GoogleError);
|
||||
ASSERT_EQ(render(Call::kA2aEngineV1MessageSend, kEngine, "v1/message"),
|
||||
"/" + kEngine + "/a2a/v1/message:send");
|
||||
}
|
||||
|
||||
TEST(runtime_gaps, beta_twin_selects_the_v1beta1_endpoint) {
|
||||
ASSERT_EQ(endpoint_of(Call::kGet, "us-central1").base_url,
|
||||
"https://us-central1-aiplatform.googleapis.com/v1");
|
||||
ASSERT_EQ(endpoint_of(Call::kGet, "us-central1", true).base_url,
|
||||
"https://us-central1-aiplatform.googleapis.com/v1beta1");
|
||||
ASSERT_EQ(endpoint_of(Call::kFeedbackList, "us-central1").base_url,
|
||||
"https://us-central1-aiplatform.googleapis.com/v1beta1");
|
||||
Rig r;
|
||||
AgentRuntime beta(r.client, r.ctx, nullptr, true);
|
||||
ASSERT_TRUE(beta.beta());
|
||||
ASSERT_EQ(beta.endpoint().base_url, "https://us-central1-aiplatform.googleapis.com/v1beta1");
|
||||
AgentRuntime v1(r.client, r.ctx);
|
||||
ASSERT_EQ(v1.endpoint().base_url, "https://us-central1-aiplatform.googleapis.com/v1");
|
||||
}
|
||||
|
||||
TEST(runtime_a2a, every_op_builds_the_path_discovery_declares) {
|
||||
Rig r;
|
||||
RuntimeA2a a2a(r.client, r.ctx);
|
||||
struct Case {
|
||||
A2aOp op;
|
||||
const char* tail; // after /a2a/ (plain)
|
||||
const char* verb; // suffix appended by the rpc path
|
||||
};
|
||||
const Case cases[] = {
|
||||
{A2aOp::kCard, "card", ""},
|
||||
{A2aOp::kExtendedAgentCard, "extendedAgentCard", ""},
|
||||
{A2aOp::kTasks, "tasks", ""},
|
||||
{A2aOp::kTaskGet, "tasks/t1", ""},
|
||||
{A2aOp::kPushConfigs, "tasks/t1/pushNotificationConfigs", ""},
|
||||
{A2aOp::kPushConfigGet, "tasks/t1/pushNotificationConfigs/c1", ""},
|
||||
{A2aOp::kTaskCancel, "tasks/t1", ":cancel"},
|
||||
{A2aOp::kTaskSubscribe, "tasks/t1", ":subscribe"},
|
||||
{A2aOp::kMessageSend, "message", ":send"},
|
||||
{A2aOp::kMessageStream, "message", ":stream"},
|
||||
};
|
||||
for (A2aTarget target : {A2aTarget::kEngine, A2aTarget::kRevision})
|
||||
for (A2aProtocol proto : {A2aProtocol::kPlain, A2aProtocol::kV1})
|
||||
for (const Case& c : cases) {
|
||||
A2aRequest q;
|
||||
q.target = target;
|
||||
q.protocol = proto;
|
||||
q.op = c.op;
|
||||
q.engine_id = "e1";
|
||||
if (target == A2aTarget::kRevision) q.revision_id = "rev9";
|
||||
if (std::string(c.tail).find("t1") != std::string::npos) q.task_id = "t1";
|
||||
if (std::string(c.tail).find("c1") != std::string::npos) q.config_id = "c1";
|
||||
std::string want = "/" + kEngine +
|
||||
(target == A2aTarget::kRevision ? "/runtimeRevisions/rev9" : "") +
|
||||
"/a2a/" + (proto == A2aProtocol::kV1 ? "v1/" : "") + c.tail + c.verb;
|
||||
ASSERT_EQ(a2a.path_of(q), want);
|
||||
// the row behind it is the one Discovery names for this (target, protocol, op)
|
||||
std::string rpc = spec_of(RuntimeA2a::call_of(target, proto, c.op)).rpc_id;
|
||||
ASSERT_TRUE(rpc.find(target == A2aTarget::kRevision ? "runtimeRevisions.a2a." : ".a2a.") !=
|
||||
std::string::npos);
|
||||
ASSERT_EQ(rpc.find(".v1.") != std::string::npos, proto == A2aProtocol::kV1);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(runtime_a2a, validation_and_caps) {
|
||||
Rig r;
|
||||
RuntimeA2a a2a(r.client, r.ctx);
|
||||
A2aRequest q;
|
||||
q.engine_id = "e1";
|
||||
q.op = A2aOp::kTaskGet;
|
||||
ASSERT_TRUE(invalid([&] { a2a.path_of(q); })); // task id missing
|
||||
q.task_id = "a/b";
|
||||
ASSERT_TRUE(invalid([&] { a2a.path_of(q); }));
|
||||
q.task_id = "t1";
|
||||
q.history_length = A2aCaps::kMaxHistoryLength + 1;
|
||||
ASSERT_TRUE(invalid([&] { a2a.path_of(q); }));
|
||||
q.history_length = 5;
|
||||
ASSERT_EQ(a2a.path_of(q), "/" + kEngine + "/a2a/tasks/t1?historyLength=5");
|
||||
A2aRequest card;
|
||||
card.engine_id = "e1";
|
||||
card.config_id = "c";
|
||||
ASSERT_TRUE(invalid([&] { a2a.path_of(card); })); // config id on an op without one
|
||||
card.config_id.clear();
|
||||
card.revision_id = "rev";
|
||||
ASSERT_TRUE(invalid([&] { a2a.path_of(card); })); // revision id on an engine target
|
||||
A2aRequest send;
|
||||
send.engine_id = "e1";
|
||||
send.op = A2aOp::kMessageSend;
|
||||
send.history_length = 3;
|
||||
ASSERT_TRUE(invalid([&] { a2a.path_of(send); })); // history is for GET ops
|
||||
send.history_length = 0;
|
||||
send.body = Json("text");
|
||||
ASSERT_TRUE(invalid([&] { a2a.call(send); }));
|
||||
send.body = Json::object();
|
||||
ASSERT_TRUE(reaches_credential_check([&] { a2a.call(send); }));
|
||||
A2aRequest streaming;
|
||||
streaming.engine_id = "e1";
|
||||
streaming.op = A2aOp::kMessageStream;
|
||||
ASSERT_TRUE(invalid([&] { a2a.call(streaming); }));
|
||||
A2aRequest sub;
|
||||
sub.engine_id = "e1";
|
||||
sub.op = A2aOp::kTaskSubscribe;
|
||||
sub.task_id = "t1";
|
||||
ASSERT_TRUE(invalid([&] { a2a.call(sub); }));
|
||||
ASSERT_TRUE(invalid([&] { a2a.stream(sub, nullptr); }));
|
||||
ASSERT_TRUE(invalid([&] { a2a.subscribe(card); }));
|
||||
ASSERT_TRUE(reaches_credential_check([&] { a2a.subscribe(sub); }));
|
||||
ASSERT_EQ(r.mock->send_count(), 0u);
|
||||
}
|
||||
|
||||
TEST(runtime_a2a, tasks_and_records_validation) {
|
||||
Rig r;
|
||||
RuntimeA2a a2a(r.client, r.ctx);
|
||||
A2aTaskInfo t;
|
||||
t.context_id = "ctx";
|
||||
t.metadata = Json::object();
|
||||
ASSERT_TRUE(invalid([&] { a2a.create_task("e1", "", t); }));
|
||||
ASSERT_TRUE(invalid([&] { a2a.create_task("e1", "Upper", t); }));
|
||||
ASSERT_TRUE(invalid([&] { a2a.create_task("e1", "-lead", t); }));
|
||||
ASSERT_TRUE(invalid([&] { a2a.create_task("e1", std::string(64, 'a'), t); }));
|
||||
ASSERT_TRUE(reaches_credential_check([&] { a2a.create_task("e1", "task-1", t); }));
|
||||
A2aTaskInfo bad;
|
||||
bad.metadata = Json("not an object");
|
||||
ASSERT_TRUE(invalid([&] { a2a.create_task("e1", "task-1", bad); }));
|
||||
ASSERT_TRUE(invalid([&] { a2a.delete_task("e1", "t1", false); }));
|
||||
ASSERT_TRUE(invalid([&] { a2a.delete_record("s1", "r1", false); }));
|
||||
ASSERT_TRUE(invalid([&] { a2a.get_task("e1", "t1", "lower"); }));
|
||||
ASSERT_TRUE(invalid([&] { a2a.list_tasks("e1", std::string(513, 'f')); }));
|
||||
ASSERT_TRUE(invalid([&] { a2a.append_task_events("e1", "t1", Json::array()); }));
|
||||
ASSERT_TRUE(invalid([&] { a2a.append_task_events("e1", "t1", Json("x")); }));
|
||||
Json events = Json::array();
|
||||
events.push(Json::object());
|
||||
ASSERT_TRUE(reaches_credential_check([&] { a2a.append_task_events("e1", "t1", events, "7"); }));
|
||||
ASSERT_TRUE(invalid([&] { a2a.create_record("s/1", "r1", t); }));
|
||||
ASSERT_TRUE(invalid([&] { a2a.get_record("s1", "a/b"); }));
|
||||
ASSERT_TRUE(reaches_credential_check([&] { a2a.create_record("s1", "", t); }));
|
||||
ASSERT_TRUE(reaches_credential_check([&] { a2a.list_record_events("s1", "r1"); }));
|
||||
ASSERT_EQ(a2a.store_name("s1"), "projects/p1/locations/us-central1/taskStores/s1");
|
||||
// writable fields only
|
||||
Json body = t.to_json();
|
||||
ASSERT_TRUE(body.find("contextId") != nullptr);
|
||||
ASSERT_TRUE(body.find("state") == nullptr);
|
||||
A2aTaskInfo parsed = A2aTaskInfo::from_json(Json::parse(
|
||||
"{\"name\":\"n\",\"status\":{\"state\":\"TASK_STATE_WORKING\"},\"generation\":\"3\"}"));
|
||||
ASSERT_EQ(parsed.state, "TASK_STATE_WORKING");
|
||||
ASSERT_EQ(parsed.generation, "3");
|
||||
ASSERT_EQ(r.mock->send_count(), 0u);
|
||||
}
|
||||
|
||||
TEST(runtime_feedback, entry_body_mask_and_gates) {
|
||||
Rig r;
|
||||
RuntimeFeedback fb(r.client, r.ctx);
|
||||
FeedbackEntry e;
|
||||
e.feedback_type = "THUMBS_DOWN";
|
||||
e.feedback_text = "wrong answer";
|
||||
e.feedback_labels = {"accuracy", "tone"};
|
||||
e.session_id = "s1";
|
||||
Json body = e.to_json();
|
||||
ASSERT_TRUE(body.find("feedbackLabels") != nullptr);
|
||||
ASSERT_TRUE(body.find("createTime") == nullptr); // output only: never sent
|
||||
ASSERT_EQ(e.update_mask(), "sessionId,feedbackType,feedbackText,feedbackLabels");
|
||||
ASSERT_EQ(fb.entry_name("e1", "f1"), kEngine + "/feedbackEntries/f1");
|
||||
ASSERT_TRUE(reaches_credential_check([&] { fb.create("e1", e); }));
|
||||
ASSERT_TRUE(reaches_credential_check([&] { fb.patch("e1", "f1", e); }));
|
||||
ASSERT_TRUE(invalid([&] { fb.create("e1", FeedbackEntry{}); })); // nothing to send
|
||||
ASSERT_TRUE(invalid([&] { fb.patch("e1", "f1", FeedbackEntry{}); }));
|
||||
ASSERT_TRUE(invalid([&] { fb.patch("e1", "a/b", e); }));
|
||||
ASSERT_TRUE(invalid([&] { fb.destroy("e1", "f1", false); }));
|
||||
FeedbackEntry big;
|
||||
big.feedback_text = std::string(FeedbackCaps::kMaxTextChars + 1, 'x');
|
||||
ASSERT_TRUE(invalid([&] { fb.create("e1", big); }));
|
||||
FeedbackEntry many;
|
||||
many.feedback_labels.assign(FeedbackCaps::kMaxLabels + 1, "l");
|
||||
ASSERT_TRUE(invalid([&] { fb.create("e1", many); }));
|
||||
ASSERT_TRUE(invalid([&] { fb.update_context("e1", "f1", Json::array()); }));
|
||||
ASSERT_TRUE(invalid([&] { fb.list("e1", std::string(513, 'f')); }));
|
||||
ASSERT_TRUE(invalid([&] { fb.get("e1", "a/b"); }));
|
||||
ASSERT_THROW(fb.list("e1"), NotConfiguredError);
|
||||
ASSERT_THROW(fb.get_context("e1", "f1"), NotConfiguredError);
|
||||
ASSERT_EQ(r.mock->send_count(), 0u);
|
||||
}
|
||||
|
||||
TEST(runtime_operations, scopes_names_and_gates) {
|
||||
ASSERT_TRUE(OperationCalls::scope_from(kEngine + "/operations/1") == OperationScope::kEngine);
|
||||
ASSERT_TRUE(OperationCalls::scope_from(kEngine + "/runtimeRevisions/r/operations/1") ==
|
||||
OperationScope::kRevision);
|
||||
ASSERT_TRUE(OperationCalls::scope_from(kEngine + "/feedbackEntries/f/operations/1") ==
|
||||
OperationScope::kFeedback);
|
||||
ASSERT_TRUE(OperationCalls::scope_from(kEngine + "/examples/x/operations/1") ==
|
||||
OperationScope::kExample);
|
||||
ASSERT_TRUE(OperationCalls::scope_from("projects/p1/locations/l/taskStores/s/operations/1") ==
|
||||
OperationScope::kTaskStore);
|
||||
ASSERT_THROW(OperationCalls::scope_from("projects/p1/operations/1"), GoogleError);
|
||||
// a name only passes for its own scope
|
||||
ASSERT_THROW(OperationCalls::check(OperationScope::kEngine, kEngine + "/feedbackEntries/f/operations/1"),
|
||||
GoogleError);
|
||||
ASSERT_THROW(OperationCalls::check(OperationScope::kRevision, kEngine + "/operations/1"),
|
||||
GoogleError);
|
||||
ASSERT_THROW(OperationCalls::check(OperationScope::kEngine, "x/" + kEngine + "/operations/1"),
|
||||
GoogleError);
|
||||
ASSERT_THROW(OperationCalls::check(OperationScope::kEngine, kEngine + "/operations/../x"),
|
||||
GoogleError);
|
||||
ASSERT_THROW(OperationCalls::check(OperationScope::kEngine, kEngine + "/operations/1?x=1"),
|
||||
GoogleError);
|
||||
ASSERT_FALSE(OperationCalls::has_list(OperationScope::kExample));
|
||||
// every scope maps its verbs onto distinct rows
|
||||
std::set<int> calls;
|
||||
for (OperationScope s : {OperationScope::kEngine, OperationScope::kRevision,
|
||||
OperationScope::kFeedback, OperationScope::kTaskStore})
|
||||
for (const char* verb : {"get", "list", "cancel", "wait", "delete"})
|
||||
ASSERT_TRUE(calls.insert(static_cast<int>(OperationCalls::call_for(s, verb))).second);
|
||||
Rig r;
|
||||
OperationCalls ops(r.client, "us-central1", false);
|
||||
const std::string rev = kEngine + "/runtimeRevisions/r/operations/1";
|
||||
ASSERT_TRUE(invalid([&] { ops.wait(OperationScope::kRevision, rev, 0); }));
|
||||
ASSERT_TRUE(invalid([&] { ops.wait(OperationScope::kRevision, rev, ScopedOperationCaps::kMaxWaitSeconds + 1); }));
|
||||
ASSERT_TRUE(invalid([&] { ops.remove(OperationScope::kRevision, rev, false); }));
|
||||
ASSERT_TRUE(invalid([&] { ops.list(OperationScope::kExample, kEngine + "/examples/x"); }));
|
||||
ASSERT_TRUE(invalid([&] { ops.list(OperationScope::kFeedback, kEngine); })); // wrong parent
|
||||
ASSERT_TRUE(invalid([&] { ops.get(OperationScope::kEngine, rev); }));
|
||||
ASSERT_THROW(ops.wait(OperationScope::kRevision, rev, 30), NotConfiguredError);
|
||||
ASSERT_THROW(ops.list(OperationScope::kFeedback, kEngine + "/feedbackEntries/f"),
|
||||
NotConfiguredError);
|
||||
ASSERT_EQ(r.mock->send_count(), 0u);
|
||||
// AgentRuntime hands out the same helper
|
||||
AgentRuntime rt(r.client, r.ctx, nullptr, true);
|
||||
ASSERT_THROW(rt.operations().get(OperationScope::kEngine, kEngine + "/operations/1"),
|
||||
NotConfiguredError);
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
// Opt-in live, read-only checks for the closed gaps (MOLO_LIVE_NET=1,
|
||||
// GOOGLE_ACCESS_TOKEN, GOOGLE_CLOUD_PROJECT): the v1beta1 resources of an
|
||||
// engine that does not exist answer 404 NOT_FOUND, which proves the route,
|
||||
// the auth and the error mapping without touching anything. Nothing is
|
||||
// created, changed or deleted.
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
#include "framework.h"
|
||||
#include "google/credentials.h"
|
||||
#include "google/errors.h"
|
||||
#include "google/runtime/a2a.h"
|
||||
#include "google/runtime/agent_runtime.h"
|
||||
#include "google/runtime/feedback.h"
|
||||
|
||||
using namespace molo::google;
|
||||
using namespace molo::google::runtime;
|
||||
|
||||
namespace {
|
||||
bool ready() {
|
||||
return std::getenv("MOLO_LIVE_NET") && !Credentials::env("GOOGLE_ACCESS_TOKEN").empty() &&
|
||||
!Credentials::env("GOOGLE_CLOUD_PROJECT").empty();
|
||||
}
|
||||
template <typename F>
|
||||
void expect_status(const char* what, int want, F&& f) {
|
||||
try {
|
||||
f();
|
||||
FAIL(std::string(what) + ": expected " + std::to_string(want) + ", got success");
|
||||
} catch (const GoogleError& e) {
|
||||
std::cout << " " << what << ": " << e.http_status() << " " << e.status() << "\n";
|
||||
ASSERT_EQ(e.http_status(), want);
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
TEST(runtime_live_extra, v1beta1_resources_of_a_missing_engine) {
|
||||
if (!ready()) {
|
||||
std::cout << "SKIP runtime_live_extra.v1beta1_resources_of_a_missing_engine (set MOLO_LIVE_NET=1, "
|
||||
"GOOGLE_ACCESS_TOKEN and GOOGLE_CLOUD_PROJECT)\n";
|
||||
return;
|
||||
}
|
||||
CloudContext ctx = CloudContext::from_env();
|
||||
ctx.location = "us-central1";
|
||||
auto client = GoogleClient::from_env();
|
||||
AgentRuntime v1(client, ctx);
|
||||
AgentRuntime beta(client, ctx, nullptr, true);
|
||||
const std::string missing = "1234567890123";
|
||||
std::cout << " engines (v1): " << v1.list().size() << ", (v1beta1): " << beta.list().size() << "\n";
|
||||
ASSERT_EQ(v1.list().size(), beta.list().size());
|
||||
expect_status("v1beta1 get of a missing engine", 404, [&] { beta.get(missing); });
|
||||
expect_status("v1 IAM policy of a missing engine", 404, [&] { v1.get_iam_policy(missing); });
|
||||
expect_status("revisions list of a missing engine", 404, [&] { v1.list_revisions(missing); });
|
||||
RuntimeFeedback fb(client, ctx);
|
||||
expect_status("feedback list of a missing engine", 404, [&] { fb.list(missing); });
|
||||
RuntimeA2a a2a(client, ctx);
|
||||
expect_status("a2aTasks list of a missing engine", 404, [&] { a2a.list_tasks(missing); });
|
||||
A2aRequest card;
|
||||
card.engine_id = missing;
|
||||
card.protocol = A2aProtocol::kV1;
|
||||
expect_status("a2a v1 card of a missing engine", 404, [&] { a2a.call(card); });
|
||||
card.protocol = A2aProtocol::kPlain;
|
||||
expect_status("a2a card of a missing engine", 404, [&] { a2a.call(card); });
|
||||
// operations of an engine: a missing engine has none, and the list answers 200.
|
||||
OperationCalls ops = v1.operations();
|
||||
auto listed = ops.list(OperationScope::kEngine, ctx.child("reasoningEngines", missing));
|
||||
std::cout << " operations of a missing engine: " << listed.size() << "\n";
|
||||
ASSERT_EQ(listed.size(), 0u);
|
||||
expect_status("operation get of a missing engine", 404, [&] {
|
||||
ops.get(OperationScope::kEngine, ctx.child("reasoningEngines", missing) + "/operations/1");
|
||||
});
|
||||
// The task store route answered 501 (not implemented) in this project.
|
||||
try {
|
||||
a2a.list_records("s1");
|
||||
std::cout << " task store list: 200\n";
|
||||
} catch (const GoogleError& e) {
|
||||
std::cout << " task store list: " << e.http_status() << " " << e.status() << "\n";
|
||||
ASSERT_TRUE(e.http_status() == 404 || e.http_status() == 501 || e.http_status() == 403);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user