Tests read build-agent and route-proxy from this repository when they live here (issue 1019)
This commit is contained in:
@@ -3,6 +3,7 @@ package catalogue
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -16,9 +17,22 @@ import (
|
|||||||
// real parser (novox/hq ADR 0100):
|
// 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
|
// 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.
|
// 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/<module> 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 {
|
func catalogueManifest(t *testing.T, module string) Manifest {
|
||||||
t.Helper()
|
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 {
|
if err != nil {
|
||||||
t.Fatalf("%s does not parse:\n%v", module, err)
|
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.
|
// templates composes with it, and one that did not is resolved as it was.
|
||||||
func catalogueResolved(t *testing.T, module string, built ...Built) Manifest {
|
func catalogueResolved(t *testing.T, module string, built ...Built) Manifest {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
dir := filepath.Join(beside.Catalogue(t), module)
|
root, dir := moduleTree(t, module)
|
||||||
m, err := ReadTreeManifestWritten(beside.Dir(t, "mesh-catalog"), dir)
|
m, err := ReadTreeManifestWritten(root, dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%s does not parse:\n%v", module, err)
|
t.Fatalf("%s does not parse:\n%v", module, err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user