Skip to content

Commit

Permalink
Metricbeat: Don't filter filesystems in Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoriano committed Apr 16, 2018
1 parent b9a9aa1 commit 0222403
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 28 deletions.
5 changes: 5 additions & 0 deletions metricbeat/module/system/filesystem/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ func GetFileSystemList() ([]sigar.FileSystem, error) {
return nil, err
}

if runtime.GOOS == "windows" {
// No filtering on Windows
return fss.List, nil
}

return filterFileSystemList(fss.List), nil
}

Expand Down
28 changes: 0 additions & 28 deletions metricbeat/module/system/filesystem/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,34 +140,6 @@ func TestFileSystemListFiltering(t *testing.T) {
}
}

func TestFileSystemListFilteringWindows(t *testing.T) {
if runtime.GOOS != "windows" {
t.Skip("These cases only need to work on windows")
}

cases := []struct {
description string
fss, expected []sigar.FileSystem
}{
{
description: "Keep all filesystems in Windows",
fss: []sigar.FileSystem{
{DirName: "C:\\", DevName: "C:\\"},
{DirName: "D:\\", DevName: "D:\\"},
},
expected: []sigar.FileSystem{
{DirName: "C:\\", DevName: "C:\\"},
{DirName: "D:\\", DevName: "D:\\"},
},
},
}

for _, c := range cases {
filtered := filterFileSystemList(c.fss)
assert.ElementsMatch(t, c.expected, filtered, c.description)
}
}

func TestFilter(t *testing.T) {
in := []sigar.FileSystem{
{SysTypeName: "nfs"},
Expand Down

0 comments on commit 0222403

Please sign in to comment.