From 9d9e4a5ea704b86497d4299553903c25002d1f3f Mon Sep 17 00:00:00 2001 From: kisfenyo Date: Sun, 5 Jul 2026 22:30:01 +0200 Subject: [PATCH] test(hub): collector OOB stanza wiring (H1) Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01PSK5g6qYLknKj8u3QAFEr6 --- internal/hub/collect_mgmtplane_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/internal/hub/collect_mgmtplane_test.go b/internal/hub/collect_mgmtplane_test.go index f617d2b..3e36a13 100644 --- a/internal/hub/collect_mgmtplane_test.go +++ b/internal/hub/collect_mgmtplane_test.go @@ -39,3 +39,27 @@ func TestCollect_MgmtPlanePopulatedWhenWired(t *testing.T) { 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) + } +}