Archived
Give the uplink seat its verbs, staged until its holders serve them (hq ADR 0241)
mesh/delivery-group group feat/node-uplink-verbs ready: every member ready, and composed together they pass
mesh/merge-gate pass: builds build-agent, mesh-controller, route-proxy → ace, g14, novox, shanks; no bus step; every machine composes with the change as it…
mesh/repo-check fail: its merge-check.sh failed: FAIL github.com/novox/mesh-controller/cmd/mesh-controller 1800.041s
mesh/delivery superseded: a newer head of the same pull request
mesh/delivery-group group feat/node-uplink-verbs ready: every member ready, and composed together they pass
mesh/merge-gate pass: builds build-agent, mesh-controller, route-proxy → ace, g14, novox, shanks; no bus step; every machine composes with the change as it…
mesh/repo-check fail: its merge-check.sh failed: FAIL github.com/novox/mesh-controller/cmd/mesh-controller 1800.041s
mesh/delivery superseded: a newer head of the same pull request
What a machine resolves through and over which links had no tool: the resolver file and its writer, and each link with its routes and resolvers, are now verbs of node-uplink, the same whatever manages the network. A verb required at once would refuse every holder before the catalogue could serve it, and a stored one would be required by an older controller, so it is staged: promised and routed, never stored, and not yet a condition of holding.
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
package catalogue
|
||||
|
||||
import (
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// The node-uplink seat's verbs (novox/hq ADR 0241): promised and routed, staged — not yet a condition of
|
||||
// holding — so the holders of today still hold it, a holder may name them, and nothing it does not promise.
|
||||
|
||||
func uplinkSeat(t *testing.T) Seat {
|
||||
t.Helper()
|
||||
for _, s := range DefaultSeats() {
|
||||
if s.Name == "node-uplink" {
|
||||
return s
|
||||
}
|
||||
}
|
||||
t.Fatal("no node-uplink seat")
|
||||
return Seat{}
|
||||
}
|
||||
|
||||
func TestTheUplinkSeatPromisesItsVerbsAndRequiresNoneYet(t *testing.T) {
|
||||
seat := uplinkSeat(t)
|
||||
var names []string
|
||||
for _, v := range seat.Serves {
|
||||
names = append(names, v.Name)
|
||||
}
|
||||
if !slices.Equal(names, []string{"resolvers", "links"}) || len(seat.Required()) != 0 {
|
||||
t.Fatalf("node-uplink promises %v and requires %v", names, seat.Required())
|
||||
}
|
||||
today := Manifest{Module: "networkmanager", Version: "1", Claims: []Claim{{Name: "node-uplink", Scope: ScopeNode}}}
|
||||
if err := CanHold(today, seat); err != nil {
|
||||
t.Fatalf("a holder that serves no verb yet is refused: %v", err)
|
||||
}
|
||||
serving := today
|
||||
serving.Claims = []Claim{{Name: "node-uplink", Scope: ScopeNode, Serves: []string{"resolvers", "links"}}}
|
||||
if err := CanHold(serving, seat); err != nil {
|
||||
t.Fatalf("a holder serving both is refused: %v", err)
|
||||
}
|
||||
typo := today
|
||||
typo.Claims = []Claim{{Name: "node-uplink", Scope: ScopeNode, Serves: []string{"resolver"}}}
|
||||
if err := CanHold(typo, seat); err == nil || !strings.Contains(err.Error(), "does not promise") {
|
||||
t.Fatalf("a verb the seat does not promise was accepted: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAStagedVerbIsNeverStoredAndComesBackFromTheBinary(t *testing.T) {
|
||||
seat := uplinkSeat(t)
|
||||
if stored := seat.Stored(); len(stored.Serves) != 0 {
|
||||
t.Fatalf("the row would keep %v", stored.Serves)
|
||||
}
|
||||
before := seats
|
||||
t.Cleanup(func() { seats = before })
|
||||
// A row as the store keeps it: no protocol of its own. And one an operator gave a verb of its own.
|
||||
UseSeats([]Seat{{Name: "node-uplink", Scope: ScopeNode}, {Name: "node-service-manager", Scope: ScopeNode}})
|
||||
for _, s := range Seats() {
|
||||
if s.Name == "node-uplink" && (len(s.Serves) != 2 || len(s.Staged) != 2) {
|
||||
t.Fatalf("the working set's node-uplink is %+v", s)
|
||||
}
|
||||
}
|
||||
UseSeats([]Seat{{Name: "node-uplink", Scope: ScopeNode, Serves: []Verb{{Name: "operators-own"}}}})
|
||||
for _, s := range Seats() {
|
||||
if s.Name == "node-uplink" && len(s.Serves) != 3 {
|
||||
t.Fatalf("a row with a verb of its own lost or did not gain the staged ones: %+v", s.Serves)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user