Prove a later assignments-stream membership changes nothing once the grants part's state has given one (issue 1955, ADR 0571 clause 7)
This commit is contained in:
@@ -182,7 +182,6 @@ func TestAModuleHearsEveryStreamItsMembershipNames(t *testing.T) {
|
||||
if got := consumerOf(); got != "from-grants" {
|
||||
t.Fatalf("the membership read at the follow names %q, want the grants part's", got)
|
||||
}
|
||||
mesh.Issue(t, reader)
|
||||
granted.Hears[0].Consumer = "from-grants-2"
|
||||
mesh.IssueInGrants(t, granted)
|
||||
mt.Until(t, func() error {
|
||||
@@ -191,6 +190,39 @@ func TestAModuleHearsEveryStreamItsMembershipNames(t *testing.T) {
|
||||
}
|
||||
return nil
|
||||
})
|
||||
// A later, different copy on the assignments stream changes nothing once the state has given one.
|
||||
arrived := make(chan struct{}, 1)
|
||||
probe, err := bus.Connect(bus.Credential{URL: mt.URL(t), Module: "probe", Node: "elsewhere"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
probe.Logf = func(string, ...any) {}
|
||||
t.Cleanup(probe.Close)
|
||||
stopProbe, err := probe.Raw(bus.MembershipSubject("anchor", "reader"), func(string, []byte) []byte {
|
||||
select {
|
||||
case arrived <- struct{}{}:
|
||||
default:
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Cleanup(stopProbe)
|
||||
probe.Flush()
|
||||
streamed := reader
|
||||
streamed.Hears = []bus.HeardIssued{{Stream: "MAIL", Consumer: "from-stream"}}
|
||||
mesh.Issue(t, streamed)
|
||||
select {
|
||||
case <-arrived:
|
||||
case <-time.After(5 * time.Second):
|
||||
t.Fatal("the stream's copy was not published")
|
||||
}
|
||||
again.Flush()
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
if got := consumerOf(); got != "from-grants-2" {
|
||||
t.Fatalf("the stream's copy was applied over the grants part's: the membership names %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
// novox/hq ADR 0363 §6 (issue 725): a consumer the membership names before the controller made it is bound once
|
||||
|
||||
Reference in New Issue
Block a user