diff --git a/internal/catalogue/foundation_manifests_test.go b/internal/catalogue/foundation_manifests_test.go index 49993e6a..2c94f9e6 100644 --- a/internal/catalogue/foundation_manifests_test.go +++ b/internal/catalogue/foundation_manifests_test.go @@ -178,10 +178,7 @@ func TestTheForgeHoldsTheNpmAndGitSeats(t *testing.T) { // port (ADR 0100). Composed through the whole path, because what proves the placeholder resolves // in an `env` at all is a declaration, not a manifest. func TestTheForgesOwnAddressFollowsThePortTheNodeGaveIt(t *testing.T) { - forge, err := catalogueManifest(t, "gitea").Resolve([]Built{{ - Name: "code", Kind: ArtifactBundle, - Reference: ArtifactStoreScheme + "gitea/code/blobs/" + bundleDigest, Digest: bundleDigest, - }}) + forge, err := catalogueManifest(t, "gitea").Resolve(forgeBuilt(catalogueManifest(t, "gitea"))) if err != nil { t.Fatalf("the forge's manifest does not resolve against its own build: %v", err) } @@ -234,10 +231,7 @@ func TestTheForgesOwnAddressFollowsThePortTheNodeGaveIt(t *testing.T) { func declaredGiteaSsh(t *testing.T, given map[int]int) map[string]any { t.Helper() forge := catalogueManifest(t, "gitea") - resolved, err := forge.Resolve([]Built{{ - Name: "code", Kind: ArtifactBundle, - Reference: ArtifactStoreScheme + "gitea/code/blobs/" + bundleDigest, Digest: bundleDigest, - }}) + resolved, err := forge.Resolve(forgeBuilt(forge)) if err != nil { t.Fatalf("the forge's manifest does not resolve against its own build: %v", err) } @@ -309,3 +303,15 @@ func TestANodeMayGiveTheForgesSshPortADifferentNumber(t *testing.T) { t.Fatalf("the forge is published on %v, not the port this node gave it", server["ports"]) } } + +// forgeBuilt is a build of every artifact the forge's manifest declares: its code bundle and, since the +// catalogue added it (novox/hq ADR 0251 ยง4), its npm registry's. Named from the manifest, so a third +// artifact does not break every forge test again. +func forgeBuilt(forge Manifest) []Built { + var out []Built + for _, a := range forge.Build.Artifacts { + out = append(out, Built{Name: a.Name, Kind: ArtifactBundle, + Reference: ArtifactStoreScheme + "gitea/" + a.Name + "/blobs/" + bundleDigest, Digest: bundleDigest}) + } + return out +}