From e750367a78f654782f2d36a01f15e87526b8b681 Mon Sep 17 00:00:00 2001 From: "Patrick W. Healy" Date: Wed, 16 Sep 2026 23:45:43 +0000 Subject: [PATCH] test(net): preserve local diagnostics with both publishers disabled Exercise actual local HTTP summary and full diagnostic endpoints in default summary mode while both outbound transports are disabled. Assert only the explicit detailed pull traverses BPF and neither endpoint enables outbound traffic. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d2243398-6c36-4c3d-969e-7ed7bfb5b459 --- .../status_publishing_bootstrap_test.go | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/cmd/unbounded-net-node/status_publishing_bootstrap_test.go b/cmd/unbounded-net-node/status_publishing_bootstrap_test.go index b2320b137..975622cf1 100644 --- a/cmd/unbounded-net-node/status_publishing_bootstrap_test.go +++ b/cmd/unbounded-net-node/status_publishing_bootstrap_test.go @@ -6,6 +6,7 @@ package main import ( "compress/gzip" "context" + "encoding/json" "io" "net/http" "net/http/httptest" @@ -17,6 +18,7 @@ import ( "github.com/coder/websocket" "google.golang.org/protobuf/proto" + configpkg "github.com/Azure/unbounded/internal/net/config" statusproto "github.com/Azure/unbounded/internal/net/status/proto" ) @@ -302,6 +304,7 @@ func TestStatusPublishersHonorDisabledTogglesAndJoin(t *testing.T) { cfg := &config{ NodeName: "node-a", + StatusDetailMode: configpkg.DefaultStatusDetailMode, StatusPushEnabled: false, StatusPushURL: server.URL, StatusPushInterval: time.Millisecond, @@ -311,8 +314,50 @@ func TestStatusPublishersHonorDisabledTogglesAndJoin(t *testing.T) { } health := blockedBootstrapHealthState() + status := summaryRouteFixture() + + var bpfCollections atomic.Int32 + + status.bpfCollector = func() []BpfEntry { + bpfCollections.Add(1) + + return []BpfEntry{{}} + } + health.setStatusServer(status) startStatusPublishers(context.Background(), cfg, health) + local := httptest.NewServer(newHealthMux(health)) + defer local.Close() + + for _, path := range []string{"/status/summary", "/status/json"} { + request, err := http.NewRequestWithContext(t.Context(), http.MethodGet, local.URL+path, nil) + if err != nil { + t.Fatal(err) + } + + response, err := local.Client().Do(request) + if err != nil { + t.Fatal(err) + } + + var snapshot NodeStatusResponse + + err = json.NewDecoder(response.Body).Decode(&snapshot) + _ = response.Body.Close() + + if err != nil || response.StatusCode != http.StatusOK || snapshot.NodeInfo.Name != "local" { + t.Fatalf("disabled publishers prevented local diagnostics: code=%d err=%v", response.StatusCode, err) + } + + if path == "/status/summary" { + if len(snapshot.BpfEntries) != 0 || bpfCollections.Load() != 0 { + t.Fatal("local summary collected BPF details") + } + } else if len(snapshot.BpfEntries) != 1 || bpfCollections.Load() != 1 { + t.Fatal("explicit HTTP pull did not collect full details") + } + } + done := make(chan struct{}) go func() {