Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion cmd/poller/collector/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func (c *AbstractCollector) findBestFit(homePath string, confPath string, name s
// get closest index
idx := getClosestIndex(versions, ontapVersion)
if idx >= 0 && idx < len(versions) {
selectedVersion = versions[idx].String()
selectedVersion = versions[idx].Original()
}

return filepath.Join(pathPrefix, selectedVersion), nil
Expand Down
14 changes: 14 additions & 0 deletions cmd/poller/collector/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"github.com/netapp/harvest/v2/assert"
"github.com/netapp/harvest/v2/pkg/conf"
"github.com/netapp/harvest/v2/third_party/go-version"
"log/slog"
"path/filepath"
"sort"
"testing"
)
Expand Down Expand Up @@ -119,3 +121,15 @@ func TestParseTemplateRef(t *testing.T) {
})
}
}

func Test_findBestFit_LeadingZeroVersion(t *testing.T) {
repoRoot := "../../.."
c := &AbstractCollector{
Name: "EseriesPerf",
Logger: slog.Default(),
}

got, err := c.findBestFit(repoRoot, "conf", "ssd_cache.yaml", "", buildVersion("12.00.0"))
assert.Nil(t, err)
assert.Equal(t, filepath.Base(got), "12.00.0")
}
Comment on lines +125 to +135
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

This test depends on the repository layout and a relative path (repoRoot := "../../..") plus real conf/... contents. To keep the unit tests hermetic and less brittle, consider using t.TempDir() to create a minimal conf/eseriesperf/12.00.0/ssd_cache.yaml directory structure for findBestFit to scan (and pass that temp dir as homePath).

Copilot uses AI. Check for mistakes.
1 change: 1 addition & 0 deletions cmd/tools/grafana/dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,7 @@ func TestOnlyHighlightsExpanded(t *testing.T) {
"cmode/switch.json": 2,
"cmode/workload.json": 2,
"storagegrid/fabricpool.json": 2,
"eseries/ssd_cache.json": 2,
}
// count the number of expanded sections in the dashboard and ensure num expanded = 1
VisitDashboards(
Expand Down
Loading
Loading