Skip to content

Commit

Permalink
add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ashmeenkaur committed Oct 14, 2024
1 parent 7466ee7 commit 75fed0f
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tools/mount_gcsfuse/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,35 @@ func TestMakeGcsfuseArgs(t *testing.T) {
})
}
}

func TestParseArgs_DeviceIsParsedCorrectly(t *testing.T) {
testCases := []struct {
name string
device string
mountPoint string
expectedDevice string
}{
{
name: "device_bucket_name",
device: "fake_bucket",
mountPoint: "/mnt/fake_bucket",
expectedDevice: "fake_bucket",
},
{
name: "device_bucket_name",
device: "/mnt/fake_bucket",
mountPoint: "/mnt/fake_bucket",
expectedDevice: "fake_bucket",
},
}

for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
gotDevice, _, _, err := parseArgs([]string{"/path_to_executable", tc.device, tc.mountPoint})

if assert.Nil(t, err) {
assert.Equal(t, tc.expectedDevice, gotDevice)
}
})
}
}

0 comments on commit 75fed0f

Please sign in to comment.