composer: a module that fetches from an artifact store no node reaches waits alone, never the node
Typed resolution.NoStoreError from artifactsInto (image, source, tools bundle, runtime program, templates archive), laid on its module by composeWithoutStoreFetchers with A-452's "nothing provides" words and composed again, instead of a whole-node refusal. Replaces storeHeld and modulesNeedingTheStore, whose shape list missed bundles and held stand-ins. Builds: design 47 G-22 A-452, A-461, A-461b, A-459b
This commit is contained in:
@@ -2,6 +2,7 @@ package compose
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -351,23 +352,44 @@ func TestTheStoreIsFoundByTheImageSeatsHolderAndItsListen(t *testing.T) {
|
||||
m := in.Catalogue["registry"]
|
||||
m.Listens = append(m.Listens, catalogue.Listening{Name: "other", Port: 5300, From: catalogue.FromMesh})
|
||||
in.Catalogue["registry"] = m
|
||||
// A-461: a store with no known address (two listens open to the mesh, so none is a guess) costs the modules that fetch from
|
||||
// it, not the node: those wait with the words of an unanswered requirement, and the node composes the rest.
|
||||
// A-461, A-452: a node that reaches no store address (a holder opening two listens to the mesh, so none is a guess, or a holder
|
||||
// laid name-only, found by nobody) costs the modules that fetch from it, whatever the shape of the fetch (an image, a tools
|
||||
// bundle of the runtime), and never the node: they wait with the words of an unanswered requirement, and the rest composes.
|
||||
dg := "sha256:" + strings.Repeat("a", 64)
|
||||
in.Catalogue["app"] = catalogue.Manifest{Module: "app", Version: "1",
|
||||
Resources: []map[string]any{{"id": "c", "type": "container", "name": "app", "image": "artifact-store://app/c@sha256:" + strings.Repeat("a", 64)}}}
|
||||
in.Catalogue["plain"] = catalogue.Manifest{Module: "plain", Version: "1"}
|
||||
Resources: []map[string]any{{"id": "c", "type": "container", "name": "app", "image": "artifact-store://app/c@" + dg}}}
|
||||
in.Catalogue["node-tools"] = catalogue.Manifest{Module: "node-tools", Version: "1", ToolRunner: true,
|
||||
OwnSecrets: catalogue.OwnSecrets{"broker": {Path: "/var/lib/node-tools/broker"}},
|
||||
Bundles: []catalogue.Bundle{{Name: "runtime", Source: catalogue.ArtifactStoreScheme + "node-tools/runtime/blobs/" + dg,
|
||||
Digest: dg, Language: "go", Binary: "node-tools"}}}
|
||||
in.Catalogue["plain"] = catalogue.Manifest{Module: "plain", Version: "1",
|
||||
Resources: []map[string]any{{"id": "state", "type": "directory", "path": "/var/lib/plain", "mode": "0700"}}}
|
||||
laptop := nodeOf(t, &in, "laptop")
|
||||
laptop.Assigned = append(laptop.Assigned, "app", "plain")
|
||||
laptop.Assigned = append(laptop.Assigned, "app", "node-tools", "plain")
|
||||
laptop.SealingKey = keyOf(t, "laptop")
|
||||
in.BusMinted = []string{"laptop.node-tools"}
|
||||
got, err := Render(in, "laptop", Reading)
|
||||
if err != nil {
|
||||
t.Fatalf("a holder opening two listens to the mesh refuses the whole node: %v", err)
|
||||
}
|
||||
if why := got.Rendering.NotPlaced["app"]; !strings.Contains(why, "nothing provides") || !strings.Contains(why, "opens registry (5000), other (5300) to the mesh") {
|
||||
t.Errorf("the module that fetches from the store waits with %q", why)
|
||||
if got.Rendering.ArtifactStore != "" {
|
||||
t.Errorf("the store has an address: %q", got.Rendering.ArtifactStore)
|
||||
}
|
||||
if why, held := got.Rendering.NotPlaced["plain"]; held {
|
||||
d, _, err := Compose(in, "laptop")
|
||||
if err != nil {
|
||||
t.Fatalf("a node that reaches no store address is refused whole: %v", err)
|
||||
}
|
||||
for _, m := range []string{"app", "node-tools"} {
|
||||
if why := d.LeftOutWhy[m]; !strings.Contains(why, "nothing provides") || !strings.Contains(why, "no artifact store") {
|
||||
t.Errorf("%s, which fetches from the store, waits with %q", m, why)
|
||||
}
|
||||
}
|
||||
if why, held := d.LeftOutWhy["plain"]; held {
|
||||
t.Errorf("a module that fetches nothing from the store waits: %q", why)
|
||||
}
|
||||
if !slices.ContainsFunc(d.Resources, func(r map[string]any) bool { return r["id"] == "plain.state" }) {
|
||||
t.Errorf("the rest of the node was not composed: %v", d.Resources)
|
||||
}
|
||||
// A-461b: only the listen refusal holds the store's fetchers; any other fault of finding the store (here the holder's machine is
|
||||
// on the network as first read but unknown when its assignment is read) still refuses the node.
|
||||
broken := newComposer(in)
|
||||
|
||||
Reference in New Issue
Block a user