From c55e60b3b3a1fed5c10d2d0153e805798ce3a00c Mon Sep 17 00:00:00 2001 From: chenchen Date: Thu, 11 Jun 2026 18:28:37 +0800 Subject: [PATCH] =?UTF-8?q?test(swarm):=20adapter=20=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E8=B5=B0=20admin=20=E6=97=81=E8=B7=AF=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E8=9C=82=E7=BE=A4=E8=AE=A2=E9=98=85=20gate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR#70 给 AgentCreateUserSwarm 加了订阅 gate 后,TestAgentUserSwarmsAdapter CreatesScopedDeployment(普通用户、无订阅)被 POLICY_REJECTED。该用例聚焦 adapter 的用户作用域而非 gate 本身(gate 由 TestGetUserSwarmEnabled 覆盖), 故走 admin 旁路。 Co-Authored-By: Claude Opus 4.8 (1M context) --- heicode/controller/agent_control_plane_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/heicode/controller/agent_control_plane_test.go b/heicode/controller/agent_control_plane_test.go index 41774e5..2b13dac 100644 --- a/heicode/controller/agent_control_plane_test.go +++ b/heicode/controller/agent_control_plane_test.go @@ -1008,6 +1008,9 @@ func TestAgentUserSwarmsAdapterCreatesScopedDeployment(t *testing.T) { recorder := httptest.NewRecorder() ctx, _ := gin.CreateTestContext(recorder) ctx.Set("id", 7) + // 蜂群订阅 gate(PR#70):普通用户须有开通蜂群的活跃套餐;admin 绕过(便于测试/运维)。 + // 本用例聚焦 adapter 的用户作用域,非 gate 本身(gate 见 TestGetUserSwarmEnabled),走 admin 旁路。 + ctx.Set("role", common.RoleAdminUser) ctx.Set("group", "development") ctx.Request = httptest.NewRequest(http.MethodPost, "/api/swarms", strings.NewReader(string(body))) ctx.Request.Header.Set("Content-Type", "application/json")