diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/integration_test.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/integration_test.go index a8c4365..ab8d70d 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/integration_test.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/integration_test.go @@ -19,6 +19,7 @@ import ( "git.novox.be/novox/mesh-sdk/go/announce" "git.novox.be/novox/mesh-sdk/go/asks" + "git.novox.be/novox/mesh-sdk/go/catalogue" "git.novox.be/novox/mesh-sdk/go/delivery" "git.novox.be/novox/mesh-sdk/go/process" "git.novox.be/novox/mesh-sdk/go/provider" @@ -125,8 +126,8 @@ func (b *bed) startStoppable(t *testing.T) (<-chan error, func()) { return done, stopped } -// 1297/B2b: started whole on its credential, the assigner says on the bus the four states it keeps, each readable, -// having opened every bucket it names. +// 1297/B2b: started whole on its credential, the assigner says on the bus every state its manifest declares, each readable, +// having opened every bucket it names. The states are read from module.json, so a state added there is expected here too. func TestTheAssignerStartsAndSaysWhatItKeeps(t *testing.T) { b := startBed(t, "") done := b.start(t) @@ -150,9 +151,21 @@ func TestTheAssignerStartsAndSaysWhatItKeeps(t *testing.T) { } break } - if said.Module != "mesh-delivery-assigner" || said.Node != "n1" || len(said.States) != 4 || !said.Readable("asks") || - !said.Readable("wants") || !said.Readable("differences") || !said.Readable("compositions") { - t.Fatalf("the assigner said %+v, want its four states, each readable", said) + raw, err := os.ReadFile(filepath.Join("..", "..", "module.json")) + if err != nil { + t.Fatal(err) + } + m, err := catalogue.ParseManifest(raw) + if err != nil { + t.Fatal(err) + } + if said.Module != "mesh-delivery-assigner" || said.Node != "n1" || len(said.States) != len(m.State) { + t.Fatalf("the assigner said %+v, want the %d states its manifest declares", said, len(m.State)) + } + for _, s := range m.State { + if !said.Readable(s.Name) { + t.Errorf("the assigner said %+v: its state %s is not readable", said, s.Name) + } } } diff --git a/modules/mesh-delivery-assigner/manifest_test.go b/modules/mesh-delivery-assigner/manifest_test.go index a236dcf..cf387b7 100644 --- a/modules/mesh-delivery-assigner/manifest_test.go +++ b/modules/mesh-delivery-assigner/manifest_test.go @@ -24,7 +24,7 @@ func load(t *testing.T) catalogue.Manifest { // 1297/B2a: the controller's reader (mesh-sdk catalogue, which the controller reads manifests with) takes the // manifest; it reads exactly the buckets the assigner opens (the program's list, held equal in its own test), keeps -// its four states (the differences kept read-only, 1906/D5), and holds a credential of its own. +// the states it declares (the differences kept read-only, 1906/D5), and holds a credential of its own. func TestManifest(t *testing.T) { m := load(t) if m.Module != "mesh-delivery-assigner" {