Design 47 lines 1888-1906 at b229f5c4 (test 60): the verb sits in every build seat's definition. Its judgement (what may be kept, the kept builds a node holds, the three refusals) is shared code of one domain's modules, so it is the domain SDK's (sdk/buildstep KeptArtifact, ADR 0634 §2): mesh-build-go keeps its store, sweep and tools and drops its own copy of the judgement and its table; mesh-build-node and mesh-build-image keep no build and answer over none, so a module claiming no oci-artifact-registry is refused and the holder is answered not kept. Their manifests serve the verb and invoke seat:mesh-catalog.module, which the judgement asks. Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ (Joined from 42d364fe.) Builds: design 47 G §271, §464 (BLD9) Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
62 lines
2.2 KiB
Go
62 lines
2.2 KiB
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"os"
|
|
"path/filepath"
|
|
"slices"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// CAT-BI1 (design 51 *Publishing*): the module publishes and copies through the image seat's verbs, which its manifest
|
|
// invokes, hears the seat's outcomes through its consumes, and holds no registry: no registry file, no artifact-store
|
|
// requirement, and none of its files names the store's assignment or binds it (issue 1703: the module is moved, and only
|
|
// what the mesh fills reaches its files).
|
|
func TestTheModuleInvokesTheImageSeatAndHoldsNoRegistry(t *testing.T) {
|
|
var m struct {
|
|
Requires []string `json:"requires"`
|
|
Invokes []string `json:"invokes"`
|
|
Consumes []string `json:"consumes"`
|
|
}
|
|
raw, err := os.ReadFile(filepath.Join(moduleDir, "module.json"))
|
|
if err != nil || json.Unmarshal(raw, &m) != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if want := []string{"seat:container-image-registry.publish", "seat:container-image-registry.publish-part",
|
|
"seat:container-image-registry.mirror", "seat:mesh-module-assigner.assignments", "seat:mesh-catalog.module"}; !slices.Equal(m.Invokes, want) {
|
|
t.Errorf("invokes = %v, want %v", m.Invokes, want)
|
|
}
|
|
// The seat's outcomes a copy waits on; the version comes in the ask, so version.numbered is not heard (design 47 G §413).
|
|
consumes := []string{}
|
|
for _, e := range OutcomeEvents {
|
|
consumes = append(consumes, "container-image-registry."+e)
|
|
}
|
|
if !slices.Equal(m.Consumes, consumes) {
|
|
t.Errorf("consumes = %v, want %v", m.Consumes, consumes)
|
|
}
|
|
if slices.Contains(m.Requires, "artifact-store") {
|
|
t.Errorf("requires = %v: the module holds no store", m.Requires)
|
|
}
|
|
if _, err := os.Stat(filepath.Join(moduleDir, "files", "registry")); !os.IsNotExist(err) {
|
|
t.Errorf("files/registry is still there: %v", err)
|
|
}
|
|
files := []string{filepath.Join(moduleDir, "module.json")}
|
|
entries, err := os.ReadDir(filepath.Join(moduleDir, "files"))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, e := range entries {
|
|
files = append(files, filepath.Join(moduleDir, "files", e.Name()))
|
|
}
|
|
for _, f := range files {
|
|
body, err := os.ReadFile(f)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if strings.Contains(string(body), "${bound:artifact-store") || strings.Contains(string(body), "mesh-artifact-store") {
|
|
t.Errorf("%s names the artifact store", f)
|
|
}
|
|
}
|
|
}
|