Node-engine: compose nothing of a package artifact (H-A-466) #249

Merged
mesh-tools merged 2 commits from fix/engine-package-artifacts into main 2026-11-22 03:40:18 +00:00
Showing only changes of commit cc79528acc - Show all commits
+25 -1
View File
@@ -16,6 +16,8 @@ import (
"github.com/novox/mesh-host/internal/nodegrant"
"github.com/novox/mesh-host/internal/takein"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
"git.novox.be/novox/mesh-sdk/go/catalogue"
"git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner"
@@ -62,6 +64,9 @@ func aWantNamingItsVersionIsResolvedThroughTheRegistrySeats(t *testing.T) {
parts map[string]string
missing string // a word the reason holds
said []string
// pkg names a package artifact the builder's done key carries with no reference beside what the build made: the key
// frombus hands takein.Manifest (H-A-466).
pkg string
}{
"resolved": {want: meshwants.WantsByWantNodeModuleValue{Fp: fp, Version: "1.2.3", Self: true},
parts: map[string]string{"mail:server": d("9"), "mail:files": d("1"), "mail:web": d("3")}},
@@ -70,7 +75,7 @@ func aWantNamingItsVersionIsResolvedThroughTheRegistrySeats(t *testing.T) {
"a seat that does not answer": {want: meshwants.WantsByWantNodeModuleValue{Fp: fp, Version: "1.2.3", Self: true}, down: "container-image-registry",
missing: "mail:web", said: []string{"mail at version 1.2.3: the seat container-image-registry"}},
"a package artifact": {want: meshwants.WantsByWantNodeModuleValue{Fp: fpPkg, Version: "1.2.3", Self: true}, entry: &withPackage,
parts: map[string]string{"mail:tools": d("4")}},
parts: map[string]string{"mail:tools": d("4")}, pkg: "mailapi"},
} {
var mu sync.Mutex
var said []string
@@ -139,6 +144,25 @@ func aWantNamingItsVersionIsResolvedThroughTheRegistrySeats(t *testing.T) {
if _, err := takein.Manifest(context.Background(), m, *b, nil); err != nil {
t.Errorf("%s: the take-in refused the build: %v", name, err)
}
if row.pkg != "" {
// The builder's done key carries the package, published to its registry, with no reference: the take-in waits
// for no reference of it, and what it takes in holds no package.
key := *b
key.Artifacts = append(append([]builds.BuiltArtifact(nil), b.Artifacts...),
builds.BuiltArtifact{Name: row.pkg, Kind: catalogue.ArtifactPackage, Digest: d("5")})
if _, err := takein.Manifest(context.Background(), m, key, nil); err != nil {
t.Errorf("%s: the take-in refused the done key carrying a package: %v", name, err)
}
built, err := takein.Built(context.Background(), m, key.Artifacts, nil)
if err != nil || len(built) != len(b.Artifacts) {
t.Errorf("%s: built %+v, %v: want the build's artifacts alone", name, built, err)
}
for _, a := range built {
if a.Name == row.pkg || a.Kind == catalogue.ArtifactPackage {
t.Errorf("%s: the take-in holds the package %+v", name, a)
}
}
}
for _, a := range b.Artifacts {
if a.Digest != row.parts["mail:"+a.Name] || a.Reference != referenceOf("mail", a.Name, a.Digest) {
t.Errorf("%s: artifact %+v", name, a)