Files
mesh-delivery/modules/mesh-grants/cmd/mesh-grants/hears_test.go
T
jschoubben 4ca6e478a6 mesh-grants: the membership carries the tool runner's twin spec; no twin composed
The grants part stays the one composer of filters while the tool runner makes its
own `_tools` twin: each heard entry, EVENTS included, carries the twin's filters
(the again filter named for it), ack wait, max deliver, max ack pending and
deliver policy. The pass composes no `_tools` consumer any longer, so it makes no
twin nothing reads; the reader grants add the create and delete of the module's
own twin by name. A membership of a module no longer assigned on its node is
withdrawn by a whole pass, so the runner there removes that module's twins. The
part's own hearing loop leaves EVENTS to the hub, now that the membership names it.

Builds: design 47 H2 H-A-472 (fifth, sixth, seventh, eighth and ninth addenda)
2026-11-22 19:30:19 +01:00

22 lines
1.1 KiB
Go

package main
import (
"testing"
"git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
"git.novox.be/novox/mesh-sdk/go/membership"
"git.novox.be/novox/mesh-sdk/go/process"
)
// The part's own membership names the stream running among those it hears, and hearRunning binds the part's durable on it
// (and EVENTS, which the hub reads, H-A-472 seventh addendum):
// the loop that opens the other streams leaves it alone, so no second reader takes messages of that one durable (design 47 G
// §556, A-19; the whole-part integration test lost the running event to the second reader at random).
func TestTheLoopOfOwnHearsLeavesTheStreamsADedicatedHearingOwns(t *testing.T) {
hears := []membership.HeardIssued{{Stream: nodeengine.StreamRunning, Consumer: "a_mesh-grants"}, {Stream: "mod-c_feed", Consumer: "a_mesh-grants"}, {Stream: "opened_one"}, {Stream: process.EventsStream, Consumer: "a_mesh-grants"}}
got := hearsToOpen(hears, map[string]bool{"opened_one": true})
if len(got) != 1 || got[0].Stream != "mod-c_feed" {
t.Errorf("the streams opened are %+v, want mod-c_feed alone", got)
}
}