Read the build agent's manifest from the controller's repository beside the check, where it moved (issue 1151)
mesh/repo-check head aab65b81f65c merged into trunk 6469e8238443 — pass: its merge-check.sh passed
mesh/merge-gate head aab65b81f65c merged into trunk 6469e8238443 — pass: group feat/delivery-have composed: every machine composes with the change as it di…
mesh/delivery delivered
mesh/delivery-group group feat/delivery-have delivered: every member is delivered
mesh/repo-check head aab65b81f65c merged into trunk 6469e8238443 — pass: its merge-check.sh passed
mesh/merge-gate head aab65b81f65c merged into trunk 6469e8238443 — pass: group feat/delivery-have composed: every machine composes with the change as it di…
mesh/delivery delivered
mesh/delivery-group group feat/delivery-have delivered: every member is delivered
This commit is contained in:
@@ -148,21 +148,26 @@ func TestAForgeManifestTheCatalogueDoesNotHaveIsNamed(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// theCataloguesModule is the catalogue's own manifest of a module, never a copy: the clone beside a merge
|
||||
// check (MESH_CHECK_BESIDE), where it must be; else a checkout beside this one; else the test skips aloud.
|
||||
// theCataloguesModule is a module's own manifest, never a copy: the clone beside a merge check (MESH_CHECK_BESIDE), where it
|
||||
// must be; else a checkout beside this one; else the test skips aloud. The catalogue holds it, but for the build agent,
|
||||
// which moved whole into the controller's repository (ADR 0420, issue 1019, issue 1151) and is read from there.
|
||||
func theCataloguesModule(t *testing.T, module string) []byte {
|
||||
t.Helper()
|
||||
inside := filepath.Join("mesh-catalog", "modules", module, "module.json")
|
||||
repository := "mesh-catalog"
|
||||
if module == BuilderModule {
|
||||
repository = "mesh-controller"
|
||||
}
|
||||
inside := filepath.Join(repository, "modules", module, "module.json")
|
||||
if root := os.Getenv("MESH_CHECK_BESIDE"); root != "" {
|
||||
raw, err := os.ReadFile(filepath.Join(root, inside))
|
||||
if err != nil {
|
||||
t.Fatalf("the catalogue beside this check (MESH_CHECK_BESIDE=%s) has no %s: %v", root, inside, err)
|
||||
t.Fatalf("%s beside this check (MESH_CHECK_BESIDE=%s) has no %s: %v", repository, root, inside, err)
|
||||
}
|
||||
return raw
|
||||
}
|
||||
raw, err := os.ReadFile(filepath.Join("..", "..", "..", inside))
|
||||
if err != nil {
|
||||
t.Skipf("NOT JUDGED: no catalogue beside this checkout and no MESH_CHECK_BESIDE; the merge check judges it")
|
||||
t.Skipf("NOT JUDGED: no %s beside this checkout and no MESH_CHECK_BESIDE; the merge check judges it", repository)
|
||||
}
|
||||
return raw
|
||||
}
|
||||
@@ -217,3 +222,29 @@ func TestABuildAgentManifestWithNowhereForTheCarriedBuilderIsRefused(t *testing.
|
||||
t.Fatalf("a manifest with no image artifact was pinned: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// 1151: the build agent's manifest lives in the controller's repository now (ADR 0420, issue 1019), and a merge check of
|
||||
// this repository has the controller cloned beside it, so a tree shaped like that check's, whose catalogue no longer holds
|
||||
// the build agent, is read from the controller.
|
||||
func TestTheBuildAgentsManifestIsReadFromTheControllerBesideTheCheck(t *testing.T) {
|
||||
beside := t.TempDir()
|
||||
for path, body := range map[string]string{
|
||||
"mesh-catalog/modules/nats/module.json": `{"module":"nats"}`,
|
||||
"mesh-controller/modules/build-agent/module.json": `{"module":"build-agent"}`,
|
||||
} {
|
||||
full := filepath.Join(beside, path)
|
||||
if err := os.MkdirAll(filepath.Dir(full), 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.WriteFile(full, []byte(body), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
t.Setenv("MESH_CHECK_BESIDE", beside)
|
||||
if got := string(theCataloguesModule(t, BuilderModule)); got != `{"module":"build-agent"}` {
|
||||
t.Errorf("read %s", got)
|
||||
}
|
||||
if got := string(theCataloguesModule(t, "nats")); got != `{"module":"nats"}` {
|
||||
t.Errorf("a module the catalogue holds was read as %s", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user