test(routers): 路由断言跟上上游变更(备份恢复已移除,补保留期读写)
CI / Backend (go vet + test) (push) Canceled after 0s
CI / Frontend (lint + build + test) (push) Canceled after 0s

上游 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
This commit is contained in:
opsx committed 2026-10-29 17:02:09 +00:00
1 parent 48e68250bb
commit e6c0cf134f
1 file changed
+5 -2
+5 -2
View File
@@ -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{}