Skip to content

Commit

Permalink
[ASCII-2294] Add suffix to fstype to avoid using a real type (#29371)
Browse files Browse the repository at this point in the history
  • Loading branch information
pgimalac authored Sep 18, 2024
1 parent 65e0623 commit 8f5783d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions pkg/gohai/filesystem/filesystem_nix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pkg/gohai/filesystem/filesystem_nix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}
Expand Down Expand Up @@ -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",
}
}
Expand Down

0 comments on commit 8f5783d

Please sign in to comment.