Skip to content

Commit

Permalink
[lint] Fix errors from #276 (#296)
Browse files Browse the repository at this point in the history
Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
  • Loading branch information
helsaawy authored Aug 3, 2023
1 parent 704d6c6 commit fec52bd
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkg/fs/resolve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit fec52bd

Please sign in to comment.