From f9e19814eb72653c64a01c26b9278419dc58c49f Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 30 Sep 2026 22:10:42 +0200 Subject: [PATCH] The catalogue-wide checks run against the checkout beside this one by default A check that only ran when somebody remembered a variable was a check nobody ran (novox/hq issue 134). MESH_CATALOGUE still overrides; the checks skip only when no catalogue can be found. --- internal/catalogue/catalogue_check_test.go | 26 +++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/internal/catalogue/catalogue_check_test.go b/internal/catalogue/catalogue_check_test.go index b5ecddf..4b2bed4 100644 --- a/internal/catalogue/catalogue_check_test.go +++ b/internal/catalogue/catalogue_check_test.go @@ -11,11 +11,24 @@ import ( // // 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") +// catalogueRoot is the catalogue these checks run over: MESH_CATALOGUE when set, else the checkout +// beside this one, the way the main layout has it. A check that only ran when somebody remembered a +// variable was a check nobody ran (novox/hq issue 134, 2026-09-30); it skips only when there is no +// catalogue to be found at all. +func catalogueRoot(t *testing.T) string { + t.Helper() + if root := os.Getenv("MESH_CATALOGUE"); root != "" { + return root } + sibling := filepath.Join("..", "..", "..", "mesh-catalog") + if _, err := os.Stat(filepath.Join(sibling, "modules")); err != nil { + t.Skip("no catalogue beside this checkout and MESH_CATALOGUE unset") + } + return sibling +} + +func TestEveryCatalogueManifestParses(t *testing.T) { + root := catalogueRoot(t) 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) @@ -51,10 +64,7 @@ func TestEveryCatalogueManifestParses(t *testing.T) { // definition names a domain or a public address the mesh acts on, and every value that must for now // carries its reason (novox/hq ADR 0155, issue 134). The list it prints is the one that shrinks. func TestNoCatalogueManifestNamesAnInstallation(t *testing.T) { - root := os.Getenv("MESH_CATALOGUE") - if root == "" { - t.Skip("set MESH_CATALOGUE to a catalogue checkout to run this") - } + root := catalogueRoot(t) 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) -- 2.54.0