test(hub): collector OOB stanza wiring (H1)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PSK5g6qYLknKj8u3QAFEr6
This commit is contained in:
@@ -39,3 +39,27 @@ func TestCollect_MgmtPlanePopulatedWhenWired(t *testing.T) {
|
|||||||
t.Fatalf("mgmt_plane not carried through: %+v", r.MgmtPlane)
|
t.Fatalf("mgmt_plane not carried through: %+v", r.MgmtPlane)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fakeOOB is an OOBReporter returning a fixed stanza (or nil).
|
||||||
|
type fakeOOB struct{ st *OOBStatus }
|
||||||
|
|
||||||
|
func (f fakeOOB) OOBStatus(context.Context) *OOBStatus { return f.st }
|
||||||
|
|
||||||
|
func TestCollect_OOBOmittedWhenNil(t *testing.T) {
|
||||||
|
px := &fakePx{node: "n", ns: newTestNodeStatus()}
|
||||||
|
c := NewCollector(px, fakeProber{status: "active"}, fakeObserver{}, nil, nil, nil, "h", "0.72.0", quietLogger())
|
||||||
|
r, _ := c.Collect(context.Background())
|
||||||
|
if r.OOB != nil {
|
||||||
|
t.Fatalf("no reporter → oob omitted, got %+v", r.OOB)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCollect_OOBPopulatedWhenWired(t *testing.T) {
|
||||||
|
px := &fakePx{node: "n", ns: newTestNodeStatus()}
|
||||||
|
c := NewCollector(px, fakeProber{status: "active"}, fakeObserver{}, nil, nil, nil, "h", "0.72.0", quietLogger())
|
||||||
|
c.SetOOBReporter(fakeOOB{st: &OOBStatus{FelhomSshdActive: true, FelhomSshdPort: 8822, Reachable: true}})
|
||||||
|
r, _ := c.Collect(context.Background())
|
||||||
|
if r.OOB == nil || r.OOB.FelhomSshdPort != 8822 || !r.OOB.Reachable {
|
||||||
|
t.Fatalf("oob not carried through: %+v", r.OOB)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user