From 9ab17cef8139358da7bbbebdbce4f8de9d4a1d7f Mon Sep 17 00:00:00 2001 From: pingqiu Date: Fri, 20 Nov 2026 23:37:22 -0800 Subject: [PATCH] status schema: every registered /status route is covered Co-Authored-By: Claude Opus 5.5 --- .../core/host/volume/status_schema_test.go | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/seaweed-block/core/host/volume/status_schema_test.go b/seaweed-block/core/host/volume/status_schema_test.go index 2222189579..348909f843 100644 --- a/seaweed-block/core/host/volume/status_schema_test.go +++ b/seaweed-block/core/host/volume/status_schema_test.go @@ -281,3 +281,28 @@ func TestStatusBodiesMatchTheRoutes(t *testing.T) { } } } + +// Every /status route the server registers is in the schema. +func TestStatusSchemaCoversEveryRoute(t *testing.T) { + listed := map[string]bool{} + for _, r := range statusRoutes { + listed[r.route] = true + } + for _, file := range []string{"status_server.go", "chunk_control.go"} { + src, err := os.ReadFile(file) + if err != nil { + t.Fatal(err) + } + for _, line := range strings.Split(string(src), "\n") { + i := strings.Index(line, `HandleFunc("/status`) + if i < 0 { + continue + } + route := line[i+len(`HandleFunc("`):] + route = route[:strings.Index(route, `"`)] + if !listed[route] { + t.Errorf("%s registers %s, which docs/status-schema.md does not cover", file, route) + } + } + } +}