Files
mesh-delivery/modules/mesh-delivery-view/viewstate/waits_test.go
T
jschoubben 06e5980898 VW2: the view's waits are the parts' wait-held, kept in its state waits
The view's process hears wait-held and wait-ended of every part (seats and modules; waits.go, manifest consumes) and keeps them in
its state waits under owner.step.node.module (viewstate/waits.go); view_tiers reads them through the tools bundle and names each
module's waits in the sayer's own words, {owner, step, node, on, bound, since, words} (tiers.go waitsHeld), beside the indexer's
pending revisions as the seat mesh-catalog's step take-in. No state of another module is read for a tier's waits.

Builds: design 47 G §512, §376, §498, A-242
2026-11-12 09:19:18 +01:00

20 lines
910 B
Go

package viewstate
import "testing"
func TestAWaitIsKeyedByOwnerStepNodeAndModuleAndReadFromItsBody(t *testing.T) {
w, err := ReadWait("mesh-wants", []byte(`{"step":"delivery","module":"web","node":"ace","part":"db","machines":["g14"],"since":"2026-11-12T01:00:00Z","words":"waiting for delivery of db to g14","extra-field":1}`))
if err != nil || w.Owner != "mesh-wants" || w.Key() != "mesh-wants.delivery.ace.web" || w.Words != "waiting for delivery of db to g14" || w.Machines[0] != "g14" {
t.Fatalf("wait %+v, key %q, %v", w, w.Key(), err)
}
if k := WaitKey("node-engine", "kept-build", "", "x y"); k != "node-engine.kept-build.-.x=20y" {
t.Errorf("key %q", k)
}
if _, err := ReadWait("mesh-wants", []byte(`{"module":"web"}`)); err == nil {
t.Error("a wait with no step read")
}
if w, _ := ReadWait("a", []byte(`{"owner":"b","step":"put"}`)); w.Owner != "b" {
t.Errorf("owner %+v", w)
}
}