Merge pull request 'Add the replay of issue 331 (R331)' (#58) from replays/331-a-tool-check-on-the-live-link into main
This commit was merged in pull request #58.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package link
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestReplay331 is the replay of hq issue 331 (mesh-lab R331), written with only what the node-engine had
|
||||
// before its fix so it can be laid over the commit before: every declared tool check on a live machine
|
||||
// read "no link to the bus is open" while the link was up, because the link the engine attaches — the NATS
|
||||
// link — could not ask a tool, and the queue said that as no link.
|
||||
//
|
||||
// The NATS link is attached with no connection under it, so no bus is needed: the question must reach the
|
||||
// link and fail there, not stop at the queue as if no link were open.
|
||||
func TestReplay331(t *testing.T) {
|
||||
q := &Queue{Membership: Membership{Node: "laptop"}}
|
||||
q.attach(t.Context(), &natsLink{node: "laptop"})
|
||||
_, _, err := q.AskTool(t.Context(), "sensors", "sensors_health")
|
||||
if err == nil {
|
||||
t.Fatal("asked on no connection and was answered")
|
||||
}
|
||||
if strings.Contains(err.Error(), "no link to the bus is open") {
|
||||
t.Fatalf("a tool check on the attached NATS link was refused as no link: %v", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user