test(clients): registry live reads use the global location; record live registry findings
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -36,6 +36,15 @@ bool live_ready(const char* test) {
|
||||
}
|
||||
bool have_oauth() { return Credentials::has_oauth(); }
|
||||
|
||||
// The registry is global: skills and publishers answer 503 UNAVAILABLE on a
|
||||
// regional location such as us-central1 (checked live), so registry reads use
|
||||
// "global" whatever GOOGLE_CLOUD_LOCATION says.
|
||||
CloudContext registry_context() {
|
||||
CloudContext c = CloudContext::from_env();
|
||||
c.location = "global";
|
||||
return c;
|
||||
}
|
||||
|
||||
// With OAuth the call must work, or answer 403 SERVICE_DISABLED (the API is
|
||||
// not enabled on the project: the path and auth were accepted, enabling an
|
||||
// API is a human decision this test never makes). With a key only, 401
|
||||
@@ -82,7 +91,7 @@ TEST(registry_live, audit_trail_read_needs_oauth) {
|
||||
|
||||
TEST(registry_live, registry_reads) {
|
||||
if (!live_ready("registry_live.registry_reads")) return;
|
||||
AgentRegistry reg(GoogleClient::from_env(), CloudContext::from_env());
|
||||
AgentRegistry reg(GoogleClient::from_env(), registry_context());
|
||||
for (AssetKind k : {AssetKind::kServices, AssetKind::kAgents, AssetKind::kMcpServers,
|
||||
AssetKind::kEndpoints, AssetKind::kBindings, AssetKind::kSkills,
|
||||
AssetKind::kPublishers})
|
||||
@@ -94,13 +103,13 @@ TEST(registry_live, registry_reads) {
|
||||
// answers 200 once its API is enabled; a disabled API is reported loudly.
|
||||
TEST(registry_live, v1alpha_operations_and_deny_policy_reads) {
|
||||
if (!live_ready("registry_live.v1alpha_operations_and_deny_policy_reads")) return;
|
||||
AgentRegistry alpha(GoogleClient::from_env(), CloudContext::from_env(),
|
||||
AgentRegistry alpha(GoogleClient::from_env(), registry_context(),
|
||||
RegistryVersion::kV1Alpha);
|
||||
ASSERT_EQ(alpha.version(), std::string("v1alpha"));
|
||||
for (AssetKind k : {AssetKind::kServices, AssetKind::kAgents, AssetKind::kMcpServers,
|
||||
AssetKind::kEndpoints, AssetKind::kBindings, AssetKind::kAiApplications})
|
||||
expect_read([&] { alpha.list(k); });
|
||||
AgentRegistry reg(GoogleClient::from_env(), CloudContext::from_env());
|
||||
AgentRegistry reg(GoogleClient::from_env(), registry_context());
|
||||
expect_read([&] { reg.operations(); });
|
||||
AgentGateway gw(GoogleClient::from_env(), CloudContext::from_env());
|
||||
expect_read([&] { gw.operations(); });
|
||||
|
||||
Reference in New Issue
Block a user