A module whose only fault was a secret the operator had not given yet was stated unhealthy, failed its first-node gate and was put back. The engine now reads the tool's answer through mesh-sdk go/health and states such a resource waiting, with what it waits for, on one look; a malformed wait stays unhealthy.
26 lines
1.0 KiB
Go
26 lines
1.0 KiB
Go
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)
|
|
}
|
|
}
|