Node-engine: no compiled seat list; the seat's name and verbs come from its contract, the tests give catalogue their seats (H-7, ADR 0635 §1; issue 1966)
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
package frombustest
|
||||
|
||||
import (
|
||||
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
||||
"git.novox.be/novox/mesh-sdk/go/seatlist/seatlisttest"
|
||||
)
|
||||
|
||||
// The seats the tests judge against are given to catalogue as the node-engine gives the ones it read from the bus
|
||||
// (novox/hq ADR 0635 §1); catalogue compiles none.
|
||||
func init() { catalogue.UseSeats(catalogue.SeatsFromDefinitions(seatlisttest.Definitions())) }
|
||||
@@ -0,0 +1,10 @@
|
||||
package frombus
|
||||
|
||||
import (
|
||||
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
||||
"git.novox.be/novox/mesh-sdk/go/seatlist/seatlisttest"
|
||||
)
|
||||
|
||||
// The seats the tests judge against are given to catalogue as the node-engine gives the ones it read from the bus
|
||||
// (novox/hq ADR 0635 §1); catalogue compiles none.
|
||||
func init() { catalogue.UseSeats(catalogue.SeatsFromDefinitions(seatlisttest.Definitions())) }
|
||||
@@ -42,12 +42,13 @@ func TestTheHolderOfNodeFilesIsToldSecretPlacesAndOwnedPaths(t *testing.T) {
|
||||
Resources: []map[string]any{{"id": "stub", "type": "file", "path": mcat.ResolverFile}}}
|
||||
uplink := mcat.Manifest{Module: "networkmanager", Version: "1", Claims: []mcat.Claim{{Name: "node-uplink"}},
|
||||
Resources: []map[string]any{{"id": "resolv", "type": "file", "path": mcat.ResolverFile}}}
|
||||
compiled := seats
|
||||
t.Cleanup(func() { seats = compiled })
|
||||
compiled := mcat.Seats()
|
||||
t.Cleanup(func() { mcat.UseSeats(compiled) })
|
||||
for _, order := range []string{"compiled", "reversed"} {
|
||||
if order == "reversed" {
|
||||
seats = append([]mcat.Seat(nil), compiled...)
|
||||
slices.Reverse(seats)
|
||||
reversed := append([]mcat.Seat(nil), compiled...)
|
||||
slices.Reverse(reversed)
|
||||
mcat.UseSeats(reversed)
|
||||
}
|
||||
both := mcat.Resolution{Node: "anchor", Modules: []mcat.Manifest{files, uplink, resolver}}
|
||||
w, err := resolutionFilesWords(both, files, nil, mcat.Rendering{})
|
||||
@@ -59,7 +60,7 @@ func TestTheHolderOfNodeFilesIsToldSecretPlacesAndOwnedPaths(t *testing.T) {
|
||||
t.Errorf("seat table %s: %s is owned by %q, want systemd-resolved (%s)", order, mcat.ResolverFile, o[mcat.ResolverFile], mcat.ResolverSeat)
|
||||
}
|
||||
}
|
||||
seats = compiled
|
||||
mcat.UseSeats(compiled)
|
||||
// Issue 1126, C5 and seed-8: a module carried as it runs (compose.Carried) owns its manifest's paths (OwnsPaths), as
|
||||
// the controller tells them, and not the paths its running resources are at (a directory the mesh placed).
|
||||
carried := mcat.Manifest{Module: "de-spiegel", Version: "1", OwnsPaths: []string{"/var/lib/de-spiegel/server.env"},
|
||||
|
||||
@@ -4,16 +4,6 @@ import (
|
||||
mcat "git.novox.be/novox/mesh-sdk/go/catalogue"
|
||||
)
|
||||
|
||||
// defaultSeats is the set the mesh ships with — the seed for the control plane's seat table and the fallback when it has none
|
||||
// (novox/hq ADR 0122). It is mesh-contracts' generated list, as mesh-sdk compiles it, taken whole: the node-engine keeps no copy of
|
||||
// a seat's verbs or events (design 26, ADR 0608 §5; issue 1966 ENG-3).
|
||||
var defaultSeats = mcat.DefaultSeats()
|
||||
|
||||
// seats is the working set the lookups read. It starts as the compiled defaults and is replaced by
|
||||
// what the control plane loaded from its store (novox/hq ADR 0122), so a change to the set is a
|
||||
// change to data, not to this code.
|
||||
var seats = defaultSeats
|
||||
|
||||
// configInput is the schema of mesh-config's verb: a value of the key's own type (a number for a number, never its
|
||||
// text), and a limit that is a number; every other argument a string.
|
||||
func configInput() map[string]any {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package resolution
|
||||
|
||||
import (
|
||||
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
||||
"git.novox.be/novox/mesh-sdk/go/seatlist/seatlisttest"
|
||||
)
|
||||
|
||||
// The seats the tests judge against are given to catalogue as the node-engine gives the ones it read from the bus
|
||||
// (novox/hq ADR 0635 §1); catalogue compiles none.
|
||||
func init() { catalogue.UseSeats(catalogue.SeatsFromDefinitions(seatlisttest.Definitions())) }
|
||||
@@ -1,7 +1,6 @@
|
||||
package resolution
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -71,22 +70,4 @@ func TestTheHolderIsTheModuleNotTheMachine(t *testing.T) {
|
||||
t.Fatalf("the holder was not told apart from a neighbour: %+v", holder)
|
||||
}
|
||||
|
||||
// ADR 0604 section 1, F3: the seat table written here answers as the SDK's does for the catalog seat, its four
|
||||
// verbs included, so no two copies of the table disagree.
|
||||
want, ok := mcat.SeatNamed(mcat.CatalogSeat)
|
||||
if !ok {
|
||||
t.Fatal("the SDK holds no catalog seat")
|
||||
}
|
||||
var have *mcat.Seat
|
||||
for i := range defaultSeats {
|
||||
if defaultSeats[i].Name == mcat.CatalogSeat {
|
||||
have = &defaultSeats[i]
|
||||
}
|
||||
}
|
||||
if have == nil {
|
||||
t.Fatal("the table here holds no catalog seat")
|
||||
}
|
||||
if !reflect.DeepEqual(*have, want) {
|
||||
t.Errorf("the table here has %+v, the SDK's is %+v", *have, want)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package compose
|
||||
|
||||
import (
|
||||
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
||||
"git.novox.be/novox/mesh-sdk/go/seatlist/seatlisttest"
|
||||
)
|
||||
|
||||
// The seats the tests judge against are given to catalogue as the node-engine gives the ones it read from the bus
|
||||
// (novox/hq ADR 0635 §1); catalogue compiles none.
|
||||
func init() { catalogue.UseSeats(catalogue.SeatsFromDefinitions(seatlisttest.Definitions())) }
|
||||
@@ -0,0 +1,10 @@
|
||||
package composer
|
||||
|
||||
import (
|
||||
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
||||
"git.novox.be/novox/mesh-sdk/go/seatlist/seatlisttest"
|
||||
)
|
||||
|
||||
// The seats the tests judge against are given to catalogue as the node-engine gives the ones it read from the bus
|
||||
// (novox/hq ADR 0635 §1); catalogue compiles none.
|
||||
func init() { catalogue.UseSeats(catalogue.SeatsFromDefinitions(seatlisttest.Definitions())) }
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
|
||||
oc "git.novox.be/novox/mesh-contracts/go/seats/operatorchannel"
|
||||
stdio "git.novox.be/novox/mesh-sdk/go"
|
||||
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
||||
@@ -25,7 +26,7 @@ import (
|
||||
// tool's (mesh-tools node-tools). One service, `node-engine`, answers discovery with each verb's seat, tool and node.
|
||||
|
||||
// EngineSeat is the seat.
|
||||
const EngineSeat = catalogue.EngineSeat
|
||||
const EngineSeat = nodeengine.Seat
|
||||
|
||||
// EngineToolSubject is where a verb of this node's seat is asked naming no caller.
|
||||
func EngineToolSubject(verb, node string) string {
|
||||
@@ -117,7 +118,7 @@ func (l *natsLink) ServeEngineSeat(handle EngineFunc) {
|
||||
return
|
||||
}
|
||||
apart := make(chan struct{}, apartAtOnce)
|
||||
for _, v := range catalogue.EngineVerbs() {
|
||||
for _, v := range catalogue.EngineVerbs(EngineSeat) {
|
||||
verb := v.Name
|
||||
answer := EngineAnswer(handle, verb, l.node, apart)
|
||||
meta := EngineEndpointMetadata(v, l.node)
|
||||
|
||||
Reference in New Issue
Block a user