test(cmd): require v1 cap and /api/healthz only

Update route assertions and regenerate swagger so the process no longer documents /api/cap or /api/health.
This commit is contained in:
ryan
2026-08-30 16:44:10 +08:00
parent 8931c3559c
commit 471d237af0
7 changed files with 700 additions and 591 deletions
+11 -2
View File
@@ -51,13 +51,22 @@ func TestNewOpenFlareAppRegistersServerAndWaveletUser(t *testing.T) {
got[rd.Method+" "+rd.Path] = true
}
for _, want := range []string{
"GET /api/health",
"GET /api/healthz",
"GET /api/v1/user/self",
"GET /api/v1/d/nodes",
"POST /api/cap/challenge",
"POST /api/v1/cap/challenge",
} {
if !got[want] {
t.Errorf("missing route %s", want)
}
}
for _, drop := range []string{
"GET /api/health",
"GET /healthz",
"POST /api/cap/challenge",
} {
if got[drop] {
t.Errorf("removed route still registered: %s", drop)
}
}
}
+27
View File
@@ -27,11 +27,38 @@ func TestPluginRoutesContainGoldenBaseline(t *testing.T) {
got := routeSet(app.Context())
want := loadBaseline(t)
for _, drop := range []string{
"GET /api/health",
"GET /healthz",
"POST /api/cap/challenge",
"POST /api/cap/redeem",
} {
delete(want, drop)
}
for k := range want {
if !got[k] {
t.Errorf("missing golden route %s", k)
}
}
for _, must := range []string{
"GET /api/healthz",
"POST /api/v1/cap/challenge",
"POST /api/v1/cap/redeem",
} {
if !got[must] {
t.Errorf("missing required route %s", must)
}
}
for _, drop := range []string{
"GET /api/health",
"GET /healthz",
"POST /api/cap/challenge",
"POST /api/cap/redeem",
} {
if got[drop] {
t.Errorf("removed route still registered: %s", drop)
}
}
}
func routeSet(ctx *core.Context) map[string]bool {