mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-30 04:06:34 +09:00
test(cozystack-api): require core in OpenAPI v2
An empty v2 path set satisfied the check that no sdn path is listed. Assisted-by: LLM Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
This commit is contained in:
1 parent
6fdd37ad81
commit
7375196b8b
1 file changed
+7
@@ -136,11 +136,18 @@ func TestServeSDNOffKeepsGroupOutOfOpenAPI(t *testing.T) {
|
||||
if err := json.Unmarshal(body, &v2); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
coreListed := false
|
||||
for p := range v2.Paths {
|
||||
if strings.HasPrefix(p, "/apis/core.cozystack.io/") {
|
||||
coreListed = true
|
||||
}
|
||||
if strings.HasPrefix(p, "/apis/sdn.cozystack.io") {
|
||||
t.Errorf("OpenAPI v2 lists %s with --serve-sdn=false", p)
|
||||
}
|
||||
}
|
||||
if !coreListed {
|
||||
t.Fatalf("OpenAPI v2 lists no core.cozystack.io path: %d paths", len(v2.Paths))
|
||||
}
|
||||
|
||||
if code, _ := get(t, ts, "/apis/sdn.cozystack.io/v1alpha1"); code != http.StatusNotFound {
|
||||
t.Errorf("GET /apis/sdn.cozystack.io/v1alpha1 = %d, want 404", code)
|
||||
|
||||
Reference in new issue
Block a user