Skip to content

Commit 018d717

Browse files
committed
Clarify behavior when only the default unknown disk is returned
1 parent fc89555 commit 018d717

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/integration/disk_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,18 @@ func TestDiskMetricsContent(t *testing.T) {
1818
t.Logf("Encountered partial errors collecting disk metrics: %v", errs)
1919
}
2020

21-
// Verify that we retrieved at least some metrics
21+
// If there are truly no metrics, or only the default "unknown" entry, skip in this environment.
2222
if len(metricsSlice) == 0 {
2323
t.Skip("No disk metrics found. This may indicate restricted disk access or a collection failure.")
2424
}
2525

26+
if len(metricsSlice) == 1 {
27+
if dd, ok := metricsSlice[0].(*metric.DiskData); ok &&
28+
dd.Device == "unknown" && dd.Mountpoint == "unknown" {
29+
t.Skip("Only default 'unknown' disk metric returned; disk metrics not available in this environment.")
30+
}
31+
}
32+
2633
foundValidDisk := false
2734

2835
for _, m := range metricsSlice {

0 commit comments

Comments
 (0)