From fe5472bab46c63be663db45f0102fc570c4c54b8 Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 17 Oct 2026 18:37:33 +0200 Subject: [PATCH] Tests read build-agent and route-proxy from this repository when they live here (issue 1019) --- .../catalogue/foundation_manifests_test.go | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/internal/catalogue/foundation_manifests_test.go b/internal/catalogue/foundation_manifests_test.go index 919eba9b..88e64de8 100644 --- a/internal/catalogue/foundation_manifests_test.go +++ b/internal/catalogue/foundation_manifests_test.go @@ -3,6 +3,7 @@ package catalogue import ( "encoding/json" "fmt" + "os" "path/filepath" "reflect" "strings" @@ -16,9 +17,22 @@ import ( // real parser (novox/hq ADR 0100): // the store and the broker say which of their ports the mesh guards on an adopted node, and the // filter module loads its table through a unit of its own whose stop deletes only that table. +// moduleTree is where a module is read from: this repository's own modules/ when it lives whole here +// (novox/hq ADR 0420 ยง1, issue 1019: build-agent and route-proxy), with this repository as the tree root; +// otherwise the catalogue beside, with the catalogue as the root. +func moduleTree(t *testing.T, module string) (root, dir string) { + t.Helper() + own := filepath.Join("..", "..", "modules", module) + if _, err := os.Stat(filepath.Join(own, "module.json")); err == nil { + return filepath.Join("..", ".."), own + } + return beside.Dir(t, "mesh-catalog"), filepath.Join(beside.Catalogue(t), module) +} + func catalogueManifest(t *testing.T, module string) Manifest { t.Helper() - m, err := ReadTreeManifest(beside.Dir(t, "mesh-catalog"), filepath.Join(beside.Catalogue(t), module)) + root, dir := moduleTree(t, module) + m, err := ReadTreeManifest(root, dir) if err != nil { t.Fatalf("%s does not parse:\n%v", module, err) } @@ -327,8 +341,8 @@ func forgeBuilt(forge Manifest) []Built { // templates composes with it, and one that did not is resolved as it was. func catalogueResolved(t *testing.T, module string, built ...Built) Manifest { t.Helper() - dir := filepath.Join(beside.Catalogue(t), module) - m, err := ReadTreeManifestWritten(beside.Dir(t, "mesh-catalog"), dir) + root, dir := moduleTree(t, module) + m, err := ReadTreeManifestWritten(root, dir) if err != nil { t.Fatalf("%s does not parse:\n%v", module, err) }