Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,35 @@ 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 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

According to the Repository Style Guide, hardcoded vendor checks (like dut.Vendor() == ondatra.ARISTA) should be avoided in test files. Instead, platform-specific workarounds or exceptions should be implemented as deviations.

Please define a new deviation (e.g., ManualHealthzSweepRequired) in internal/deviations/deviations.go and internal/deviations/deviations.textproto, and use it here.

Suggested change
if dut.Vendor() == ondatra.ARISTA {
if deviations.ManualHealthzSweepRequired(dut) {
References
  1. Usage in Tests: Access deviations via deviations.DeviationName(dut). (link)
  2. Avoid using 'dut.Vendor()' for vendor-specific logic or configurations in tests. Instead, use the 'deviations' package to maintain test abstraction and portability across different vendors.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use right deviation and why is this specific to Arista ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @navaneethyv ,

Good question — we used dut.Vendor() == ondatra.ARISTA directly (similar to vendorCoreFilePath in this file) because this is only post-test flash housekeeping using an EOS-specific path (/mnt/flash/persist/healthz) rather than changing any test validation or operational intent.

That said, if you'd prefer tracking the Healthz.Acknowledge fallback formally as a deviation in metadata.proto / metadata.textproto, I'm happy to add it. Let me know which approach you prefer!

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 {
Comment thread
arnavanand-lgtm marked this conversation as resolved.
Resolved
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())
}
}
}
}
}
})
}
}
Expand Down
Loading