The controller no longer subscribes to the alive message: HostBeats, its handler, the heartbeat-gap duration and a fixed silent bound (issue 1183, AC3, AC4, AC5)
mesh/merge-gate head 19e3eac74658 merged into trunk 89cfa9431d8f — pass: builds build-agent, mesh-controller → ace, g14, novox, shanks; no bus step; every …
mesh/repo-check head 19e3eac74658 merged into trunk 89cfa9431d8f — pass: its merge-check.sh passed
mesh/delivery delivered
mesh/merge-gate head 19e3eac74658 merged into trunk 89cfa9431d8f — pass: builds build-agent, mesh-controller → ace, g14, novox, shanks; no bus step; every …
mesh/repo-check head 19e3eac74658 merged into trunk 89cfa9431d8f — pass: its merge-check.sh passed
mesh/delivery delivered
This commit is contained in:
@@ -157,24 +157,31 @@ func TestNatsAnEnrolmentIsAnsweredOnTheAddressInItsPayload(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestNatsAHeartbeatIsHeardAndNothingIsKept(t *testing.T) {
|
||||
// 1183/AC3, AC5: a node-engine still sending its alive message is harmless: it errors nothing, nothing is recorded and
|
||||
// nothing is persisted; the tool runner's tools-alive is still heard.
|
||||
func TestNatsAnAliveMessageIsHarmlessAndToolsAliveIsStillHeard(t *testing.T) { // 1183/AC3
|
||||
js := aBus(t)
|
||||
store := &counted{}
|
||||
_, stop := servingOn(t, js, store)
|
||||
defer stop()
|
||||
|
||||
// Given time to subscribe: a core subscription that is not yet up misses what is published,
|
||||
// which is the guarantee a heartbeat has and not a fault.
|
||||
eventually(t, "the heartbeat subscription coming up", func() bool {
|
||||
body, _ := json.Marshal(Alive{Node: "anchor"})
|
||||
_ = js.Conn().Publish(AliveSubject("anchor"), body)
|
||||
// Given time to subscribe: a core subscription that is not yet up misses what is published.
|
||||
eventually(t, "the tools-alive subscription coming up", func() bool {
|
||||
if err := js.Conn().Publish("mesh.control.anchor.alive", []byte(`{"node":"anchor"}`)); err != nil {
|
||||
t.Fatalf("an alive message could not be published: %v", err)
|
||||
}
|
||||
body, _ := json.Marshal(ToolsAlive{Node: "anchor"})
|
||||
_ = js.Conn().Publish(ToolsAliveSubject("anchor"), body)
|
||||
_ = js.Conn().Flush()
|
||||
return store.count() >= 1
|
||||
_, heard := ToolsBeats.Of("anchor")
|
||||
return heard
|
||||
})
|
||||
if n := store.count(); n != 0 {
|
||||
t.Fatalf("an alive message was recorded %d time(s)", n)
|
||||
}
|
||||
info, err := js.Context().StreamInfo("CONTROL")
|
||||
if err != nil || info.State.Msgs != 0 {
|
||||
t.Fatalf("a heartbeat was persisted, and the mesh's least valuable message now competes "+
|
||||
"for retention with its most valuable: %+v, %v", info, err)
|
||||
t.Fatalf("an alive message was persisted: %+v, %v", info, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user