Files
mesh-delivery/modules/mesh-grants/internal/grants/catchups_test.go
T
jschoubben 8fc1997b1b fix9-8: the grants part composes the node-engine's grants for the seat mesh-recovery and for a module's catch-up tool
The node-engine of a node hears the kept events ended and restored through an ordered consumer, and calls the catch-up tool of a module placed on its node (its manifest's kept data name it); the verbs snapshot-kept, restore-kept and kept-points were granted already as the engine's invokes. No nodegrant mirror lives in mesh-delivery (it is mesh-host's).

Builds: design 47 G §406, §554, §631, A-108
2026-11-12 01:13:03 +01:00

22 lines
930 B
Go

package grants
import (
"slices"
"testing"
"git.novox.be/novox/mesh-sdk/go/catalogue"
)
// Design 47 G §406, §631, A-108: the catch-up tools a manifest's kept data name are the module's own, each once, whichever
// kind of kept data names them.
func TestCatchUpsAreTheToolsTheManifestsKeptDataName(t *testing.T) {
m, err := catalogue.Decode([]byte(`{"module":"keeper","version":"1.0","state":[{"name":"seen","form":2,"catch-up":{"tool":"seen_again","arguments":{"all":true}}},"plain"],` +
`"logs":[{"name":"lines","form":1,"catch-up":"seen_again"}],"streams":[{"name":"ev","events":["a"],"max-age-days":1,"max-mib":1,"form":1,"catch-up":{"tool":"ev_again"}}]}`))
if err != nil {
t.Fatal(err)
}
if got := catchUpsOf(m); !slices.Equal(got, []string{"seen_again", "ev_again"}) && !slices.Equal(got, []string{"ev_again", "seen_again"}) {
t.Errorf("catchUpsOf = %v, want seen_again and ev_again once each", got)
}
}