From 74ad740f8c9b0e0a02e6bbdad97283993cdcc779 Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 8 Oct 2026 13:56:09 +0200 Subject: [PATCH] Build every artifact the forge declares in the forge tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The catalogue's forge gained an npm-registry bundle (hq ADR 0251 §4), so resolving it against its code bundle alone failed three tests on main and on every pull request. --- .../catalogue/foundation_manifests_test.go | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) 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 +}