package catalogue import ( "os" "path/filepath" "testing" ) // TestEveryCatalogueManifestParses runs the real catalogue through the real gate. // // Not a fixture: the point is whether the manifests as written are accepted by the control plane that // will read them, and a copy of one manifest proves nothing about the other seventy-one. func TestEveryCatalogueManifestParses(t *testing.T) { root := os.Getenv("MESH_CATALOGUE") if root == "" { t.Skip("set MESH_CATALOGUE to a catalogue checkout to run this") } found, err := filepath.Glob(filepath.Join(root, "modules", "*", "module.json")) if err != nil || len(found) == 0 { t.Fatalf("no manifests under %s: %v", root, err) } named, routed := 0, 0 for _, p := range found { raw, err := os.ReadFile(p) if err != nil { t.Fatalf("%s: %v", p, err) } m, err := ParseManifest(raw) if err != nil { t.Errorf("%s: %v", filepath.Base(filepath.Dir(p)), err) continue } for _, l := range m.Listens { if l.Name != "" { named++ } } for port := range RoutedPorts(m) { _ = port routed++ } } t.Logf("%d manifests, %d named endpoints, %d routed endpoints resolved", len(found), named, routed) if named == 0 { t.Fatal("no endpoint in the catalogue is named, so this proved nothing") } }