diff --git a/pkg/gohai/filesystem/filesystem_nix.go b/pkg/gohai/filesystem/filesystem_nix.go index f25f6adc97d3e..27f5094d1e282 100644 --- a/pkg/gohai/filesystem/filesystem_nix.go +++ b/pkg/gohai/filesystem/filesystem_nix.go @@ -74,9 +74,7 @@ func replaceDev(oldMount, newMount MountInfo) bool { } // getFileSystemInfoWithMounts is an internal method to help testing with test mounts and mocking syscalls -func getFileSystemInfoWithMounts(initialMounts []*mountinfo.Info, sizeKB, dev fsInfoGetter) ([]MountInfo, error) { - mounts := initialMounts - +func getFileSystemInfoWithMounts(mounts []*mountinfo.Info, sizeKB, dev fsInfoGetter) ([]MountInfo, error) { devMountInfos := map[uint64]MountInfo{} for _, mount := range mounts { // Skip mounts that seem to be missing data diff --git a/pkg/gohai/filesystem/filesystem_nix_test.go b/pkg/gohai/filesystem/filesystem_nix_test.go index c41b7c369110d..55a7c92563370 100644 --- a/pkg/gohai/filesystem/filesystem_nix_test.go +++ b/pkg/gohai/filesystem/filesystem_nix_test.go @@ -117,7 +117,6 @@ func TestNixFSTypeFiltering(t *testing.T) { mounts, err := getFileSystemInfoWithMounts(inputMounts, mockFSSizeKB, getMockFSDev()) require.NoError(t, err) - require.Equal(t, len(expectedMounts), len(mounts)) assert.ElementsMatch(t, mounts, expectedMounts) }) } @@ -260,8 +259,9 @@ func TestFilterDev(t *testing.T) { func newTestInputMountinfo(name string) *mountinfo.Info { return &mountinfo.Info{ + // add suffixes to the name to avoid having an ignored source / type / mountpoint Source: name + "Source", - FSType: name, + FSType: name + "Type", Mountpoint: name + "MountPoint", } }