InstallationProblems judges every value the mesh acts on for a name under a public top-level domain
or a public address, with prose, the world's registries, resolvers and certificate authorities
exempt, and a name a resource means on purpose declared with its reason (names-on-purpose). Run by
module check and a catalogue-wide test, not yet at registration, while the declared list shrinks.
${setting:<key>} fills a file from the assignment's settings and is refused when nothing set it.
A build context may live on the git seat; the request carries the seat's clone base (novox/hq ADR
0112, ADR 0155, issues 122 and 134).
79 lines
2.3 KiB
Go
79 lines
2.3 KiB
Go
package catalogue
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
"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")
|
|
}
|
|
}
|
|
|
|
// TestNoCatalogueManifestNamesAnInstallation is ADR 0112's check, run over the real catalogue: no
|
|
// 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")
|
|
}
|
|
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)
|
|
}
|
|
var named []string
|
|
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", p, err)
|
|
continue
|
|
}
|
|
named = append(named, InstallationProblems(m)...)
|
|
}
|
|
if len(named) > 0 {
|
|
t.Fatalf("%d value(s) name an installation:\n %s", len(named), strings.Join(named, "\n "))
|
|
}
|
|
}
|