From e6c0cf134ff54004e48ac1c20baceb665c574722 Mon Sep 17 00:00:00 2001 From: opsx Date: Thu, 29 Oct 2026 17:02:09 +0000 Subject: [PATCH] =?UTF-8?q?test(routers):=20=E8=B7=AF=E7=94=B1=E6=96=AD?= =?UTF-8?q?=E8=A8=80=E8=B7=9F=E4=B8=8A=E4=B8=8A=E6=B8=B8=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=EF=BC=88=E5=A4=87=E4=BB=BD=E6=81=A2=E5=A4=8D=E5=B7=B2=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=EF=BC=8C=E8=A1=A5=E4=BF=9D=E7=95=99=E6=9C=9F=E8=AF=BB?= =?UTF-8?q?=E5=86=99=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 上游 commit f87fb4b 移除了备份恢复功能(/system/backup、/system/restore), 我上一轮加的路由守卫测试仍在断言 /system/backup 存在,导致 go test 失败。 调整为当前真实 API 面: - 移除 /api/v1/system/backup 断言 - 补 GET/PUT /api/v1/settings/retention(保留期读写) - 保留 /api/v1/system/self-check 实测:go test ./routers/ → ok --- backend/routers/router_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/routers/router_test.go b/backend/routers/router_test.go index 9075874..8952d23 100644 --- a/backend/routers/router_test.go +++ b/backend/routers/router_test.go @@ -43,10 +43,13 @@ func TestCriticalRoutes(t *testing.T) { {"GET", "/api/v1/alerts/channels"}, {"POST", "/api/v1/alerts/check"}, {"GET", "/api/v1/alerts/deliveries"}, - // 审计 / 自检 / 备份 + // 审计 / 自检 {"GET", "/api/v1/audit-logs"}, {"GET", "/api/v1/system/self-check"}, - {"GET", "/api/v1/system/backup"}, + // 设置类:保留期必须同时有读和写(写要管理员) + {"GET", "/api/v1/settings/retention"}, + {"PUT", "/api/v1/settings/retention"}, + // 备份恢复接口已在上游被移除(commit f87fb4b),这里不再断言 } registered := map[string]bool{}