From fec52bd5aab527b485f16ddbcec3fa7963380613 Mon Sep 17 00:00:00 2001 From: Hamza El-Saawy <84944216+helsaawy@users.noreply.github.com> Date: Thu, 3 Aug 2023 13:31:02 -0400 Subject: [PATCH] [lint] Fix errors from #276 (#296) Signed-off-by: Hamza El-Saawy --- pkg/fs/resolve_test.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/fs/resolve_test.go b/pkg/fs/resolve_test.go index d82ba586..f9be69f4 100644 --- a/pkg/fs/resolve_test.go +++ b/pkg/fs/resolve_test.go @@ -23,12 +23,16 @@ func getWindowsBuildNumber() uint32 { } func makeSymlink(t *testing.T, oldName string, newName string) { + t.Helper() + if err := os.Symlink(oldName, newName); err != nil { t.Fatalf("creating symlink: %s", err) } } func getVolumeGUIDPath(t *testing.T, path string) string { + t.Helper() + h, err := openMetadata(path) if err != nil { t.Fatal(err) @@ -87,6 +91,8 @@ func formatVHD(vhdHandle windows.Handle) error { // Creates a VHD with a NTFS volume. Returns the volume path. func setupVHDVolume(t *testing.T, vhdPath string) string { + t.Helper() + vhdHandle, err := vhd.CreateVirtualDisk(vhdPath, vhd.VirtualDiskAccessNone, vhd.CreateVirtualDiskFlagNone, &vhd.CreateVirtualDiskParameters{ @@ -122,12 +128,16 @@ func setupVHDVolume(t *testing.T, vhdPath string) string { } func writeFile(t *testing.T, path string, content []byte) { + t.Helper() + if err := os.WriteFile(path, content, 0644); err != nil { //nolint:gosec // test file, can have permissive mode t.Fatal(err) } } func mountVolume(t *testing.T, volumePath string, mountPoint string) { + t.Helper() + // Create the mount point directory. if err := os.Mkdir(mountPoint, 0644); err != nil { t.Fatal(err) @@ -165,7 +175,7 @@ func mountVolume(t *testing.T, volumePath string, mountPoint string) { func TestResolvePath(t *testing.T) { if !windows.GetCurrentProcessToken().IsElevated() { - t.Fatal("test requires elevated privileges") + t.Skip("requires elevated privileges") } // Set up some data to be used by the test cases.