mesh/delivery merged: source.main moved to novox/mesh-controller@c58b311ea774
mesh/delivery-group group feat/072-moves merged: every member is merged
mesh/check failed: shanks: the check of novox/mesh-controller#487 failed: go mod download in modules/route-proxy: go: git.novox.be/novox/mesh-controll…
The controller is being removed, so its root module goes back to origin/main's mesh-sdk pin (2da0de7) and
testdata/beside's capture; route-proxy keeps its own pins. Its one functional change stays the account issue:
- Before the grants part's take-over (its key user-list.sealed not saying FollowGrants) the bus loads the
controller's list, whose hashes come only from its store, so the controller mints as before and hands every
account it mints, covered or not, to an installed vault at once: no account waits on a node reporting its hash.
- From the take-over it forwards the issue to the vault's issue-account (d791052f) and mints nothing.
And the controller no longer declares or asserts the ASSIGNMENTS stream, which the bus module's tools delete at the
lease write and nothing may make again (research 072 row 33); the verified-sender re-issue stops once it is gone.
Research 072 piece: the gap "vault mints after the lease", the minting piece moves to the vault from the take-over.
63 lines
2.2 KiB
Go
63 lines
2.2 KiB
Go
//go:build integration
|
|
|
|
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
|
|
"github.com/nats-io/nats.go"
|
|
|
|
"github.com/novox/mesh-controller/internal/broker"
|
|
"github.com/novox/mesh-controller/internal/link"
|
|
"github.com/novox/mesh-controller/internal/testbus"
|
|
)
|
|
|
|
func TestNatsAMembershipIssuedWithoutItsVerifiedSenderIsIssuedAgainWhenTheJudgementPasses(t *testing.T) {
|
|
js, err := broker.Dial(testbus.URL(t))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Cleanup(js.Close)
|
|
// The assignments stream is no longer the mesh's (research 072 row 33): it is asserted by nothing, and stays on a
|
|
// bus only until the lease write deletes it. Made here as it is left there.
|
|
if _, err := js.Context().AddStream(&nats.StreamConfig{Name: broker.AssignmentsStream,
|
|
Subjects: []string{"mesh.assignment.*.*"}, MaxMsgsPerSubject: 1, AllowDirect: true}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
bus := link.OverNATS{Conn: js.Conn(), JS: js.Context()}
|
|
|
|
failed, router := verifiedSenderRecords(nil)
|
|
body, err := json.Marshal(broker.MembershipFor("novox", router, broker.PlacementsOf(failed, nil)))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := bus.PublishMembership(t.Context(), "novox", "messenger", body); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
issued := func() []byte {
|
|
m, err := js.Context().GetLastMsg(broker.AssignmentsStream, broker.MembershipSubject("novox", "messenger"))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
return m.Data
|
|
}
|
|
if hasVerified(t, issued()) {
|
|
t.Fatal("issued with a failed judgement, and the verified sender is kept: the test proves nothing")
|
|
}
|
|
if n := reissueVerifiedSendersOn(t.Context(), bus, failed, broker.PlacementsOf(failed, nil)); n != 0 {
|
|
t.Fatalf("issued %d memberships while the judgement still fails", n)
|
|
}
|
|
passing, _ := verifiedSenderRecords(map[string]bool{"novox": true})
|
|
where := broker.PlacementsOf(passing, nil)
|
|
if n := reissueVerifiedSendersOn(t.Context(), bus, passing, where); n != 1 {
|
|
t.Fatalf("issued %d memberships after the judgement passed, want 1", n)
|
|
}
|
|
if !hasVerified(t, issued()) {
|
|
t.Fatal("the membership on the bus lacks the verified sender after the judgement passed")
|
|
}
|
|
if n := reissueVerifiedSendersOn(t.Context(), bus, passing, where); n != 0 {
|
|
t.Fatalf("a second pass issued %d memberships", n)
|
|
}
|
|
}
|