mesh/delivery-group group feat/sdk1 rejected: composed together: the checker's verdict at the members' heads (428d048dd50a): unit: git.novox.be/novox/mesh-sdk/…
mesh/delivery closed: a newer head of the same pull request
mesh/check failed: unit: git.novox.be/novox/mesh-sdk/go/process.TestStatePutWritesAKeyWhole: a Put through a short blackout: 0, mesh-mail's state send…
Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
70 lines
3.2 KiB
Go
70 lines
3.2 KiB
Go
package catalogue
|
|
|
|
import (
|
|
"reflect"
|
|
"slices"
|
|
"testing"
|
|
)
|
|
|
|
// The one rule replays the live cases of 2026-10-30 (issue 774): what the assigner's rule 8 waits for is what the
|
|
// composition keys, judged from the manifests alone.
|
|
func TestAwaitedIsWhatTheCompositionKeys(t *testing.T) {
|
|
built := &Handed{Source: "store://t", Digest: "sha256:t", Templates: map[string]string{"c": "c"}}
|
|
offer := func(module, name string, scope string, helper bool, serves bool) Manifest {
|
|
o := Offer{Name: name, Scope: scope}
|
|
if helper {
|
|
o.AnsweredBy = AnsweredByHelper
|
|
}
|
|
m := Manifest{Module: module, Provides: []Offer{o}}
|
|
if serves {
|
|
m.Serves = map[string]map[string]any{name: {"port": 1}}
|
|
}
|
|
return m
|
|
}
|
|
gitea, distribution := offer("gitea", "forge-account", ScopeMesh, false, false), offer("distribution", "artifact-store", ScopeMesh, false, false)
|
|
goTools, nodeJS := offer("go", "go-toolchain", ScopeNode, false, false), offer("nodejs", "node-toolchain", ScopeNode, false, false)
|
|
keycloak, proxy := offer("keycloak", "oidc-client", ScopeMesh, false, false), offer("route-proxy", "route", ScopeMesh, true, false)
|
|
adapter := offer("route-adapter", "route", ScopeMesh, false, false)
|
|
ollama := offer("ollama", "llm", ScopeNode, false, true)
|
|
by := func(ms ...Manifest) func(string) []Manifest {
|
|
return func(p string) []Manifest {
|
|
var out []Manifest
|
|
for _, m := range ms {
|
|
if slices.Contains(m.Offers(), p) {
|
|
out = append(out, m)
|
|
}
|
|
}
|
|
return out
|
|
}
|
|
}
|
|
for _, c := range []struct {
|
|
name string
|
|
consumer Manifest
|
|
providers func(string) []Manifest
|
|
want []string
|
|
}{
|
|
{"a handed builder waits for what binds, not for a toolchain on its own machine (mesh-build-go on ace)",
|
|
Manifest{Module: "mesh-build-go", Moved: true, Handed: built,
|
|
Requires: []string{"forge-account", "go-toolchain", "artifact-store", "node-tools"}},
|
|
by(gitea, distribution, goTools), []string{"artifact-store", "forge-account"}},
|
|
{"node-toolchain alike (mesh-build-node)",
|
|
Manifest{Module: "mesh-build-node", Moved: true, Handed: built, Requires: []string{"node-toolchain", "forge-account"}},
|
|
by(gitea, nodeJS), []string{"forge-account"}},
|
|
{"a module not handed waits for its route, which the helper answers, and not for its login the controller still makes (grafana on ace)",
|
|
Manifest{Module: "grafana", Requires: []string{"route", "oidc-client", "influxdb-api"},
|
|
OptionalRequires: map[string]bool{"influxdb-api": true}},
|
|
by(keycloak, proxy), []string{"route"}},
|
|
{"where providers disagree on the helper, nothing is waited for that might never be keyed",
|
|
Manifest{Module: "grafana", Requires: []string{"route"}}, by(proxy, adapter), nil},
|
|
{"a moved module with no template is not handed (a held stub, issue 1126)",
|
|
Manifest{Module: "bot", Moved: true, Handed: &Handed{}, Requires: []string{"oidc-client", "route"}},
|
|
by(keycloak, proxy), []string{"route"}},
|
|
{"a provision on its own machine that serves facts binds, and is keyed for a handed consumer",
|
|
Manifest{Module: "chat", Moved: true, Handed: built, Requires: []string{"llm", "llm"}}, by(ollama), []string{"llm"}},
|
|
} {
|
|
if got := Awaited(c.consumer, c.providers); !reflect.DeepEqual(got, c.want) {
|
|
t.Errorf("%s: awaited %v, want %v", c.name, got, c.want)
|
|
}
|
|
}
|
|
}
|