From 65bac01da55e3870e22825b2029e1587511851e1 Mon Sep 17 00:00:00 2001 From: Arnav Anand Date: Tue, 29 Sep 2026 06:18:39 +0000 Subject: [PATCH 1/2] Fix Arista healthz storage leak via gNOI file sweep fallback --- .../system_generic_health_check_test.go | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/feature/system/health/tests/system_generic_health_check/system_generic_health_check_test.go b/feature/system/health/tests/system_generic_health_check/system_generic_health_check_test.go index 378502ad5df..feea38a92ad 100644 --- a/feature/system/health/tests/system_generic_health_check/system_generic_health_check_test.go +++ b/feature/system/health/tests/system_generic_health_check/system_generic_health_check_test.go @@ -231,6 +231,31 @@ func TestComponentStatus(t *testing.T) { } else { t.Logf("INFO: Component %s Healthz Get Status: %s", component, getResponse.GetComponent().GetStatus()) } + + // Clean up artifacts from the DUT + if checkResponse != nil && checkResponse.GetStatus() != nil { + t.Logf("Acknowledging Healthz event to free device flash space...") + ackReq := &hpb.AcknowledgeRequest{ + Path: getReq.GetPath(), + Id: checkResponse.GetStatus().GetId(), + } + if _, ackErr := gnoiClient.Healthz().Acknowledge(context.Background(), ackReq); ackErr != nil { + t.Logf("Warning: Failed to acknowledge Healthz event %v: %v", ackReq.Id, ackErr) + // Fallback clause for devices that bug out on Acknowledge (e.g. Arista with blank Event IDs). + // We will manually sweep the artifacts directly through gNOI File system RPC. + if dut.Vendor() == ondatra.ARISTA { + artifacts := checkResponse.GetStatus().GetArtifacts() + for _, artifact := range artifacts { + remotePath := fmt.Sprintf("/mnt/flash/persist/healthz/%s", artifact.GetId()) + if _, rmErr := gnoiClient.File().Remove(context.Background(), &fpb.RemoveRequest{RemoteFile: remotePath}); rmErr != nil { + t.Logf("Warning: Manual sweep fallback also failed to remove artifact %v: %v", artifact.GetId(), rmErr) + } else { + t.Logf("Manual Sweep: Successfully removed artifact %v from disk to prevent storage leak", artifact.GetId()) + } + } + } + } + } }) } } From 85d735de8ef128fb956777df9771d1e5916fe645 Mon Sep 17 00:00:00 2001 From: Arnav Anand Date: Tue, 29 Sep 2026 07:18:50 +0000 Subject: [PATCH 2/2] Address review: empty artifact ID check --- .../system_generic_health_check_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/feature/system/health/tests/system_generic_health_check/system_generic_health_check_test.go b/feature/system/health/tests/system_generic_health_check/system_generic_health_check_test.go index feea38a92ad..5089aeef756 100644 --- a/feature/system/health/tests/system_generic_health_check/system_generic_health_check_test.go +++ b/feature/system/health/tests/system_generic_health_check/system_generic_health_check_test.go @@ -246,6 +246,10 @@ func TestComponentStatus(t *testing.T) { if dut.Vendor() == ondatra.ARISTA { artifacts := checkResponse.GetStatus().GetArtifacts() for _, artifact := range artifacts { + if artifact.GetId() == "" { + t.Logf("Warning: Skipping artifact with empty ID to prevent directory deletion") + continue + } remotePath := fmt.Sprintf("/mnt/flash/persist/healthz/%s", artifact.GetId()) if _, rmErr := gnoiClient.File().Remove(context.Background(), &fpb.RemoveRequest{RemoteFile: remotePath}); rmErr != nil { t.Logf("Warning: Manual sweep fallback also failed to remove artifact %v: %v", artifact.GetId(), rmErr)