Skip to content

Commit

Permalink
test: fix windows ut failures
Browse files Browse the repository at this point in the history
  • Loading branch information
andyzhangx committed Feb 2, 2024
1 parent 9c215a8 commit 6c1c3cc
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions pkg/azurefile/nodeserver_test.go
Expand Up @@ -408,12 +408,13 @@ func TestNodeStageVolume(t *testing.T) {
}

tests := []struct {
desc string
setup func()
req csi.NodeStageVolumeRequest
execScripts []ExecArgs
skipOnDarwin bool
expectedErr testutil.TestError
desc string
setup func()
req csi.NodeStageVolumeRequest
execScripts []ExecArgs
skipOnDarwin bool
skipOnWindows bool
expectedErr testutil.TestError
// use this field only when Windows
// gives flaky error messages due
// to CSI proxy
Expand Down Expand Up @@ -589,7 +590,8 @@ func TestNodeStageVolume(t *testing.T) {
VolumeCapability: &stdVolCap,
VolumeContext: volContext,
Secrets: secrets},
skipOnDarwin: true,
skipOnDarwin: true,
skipOnWindows: true,
flakyWindowsErrorMessage: fmt.Sprintf("volume(vol_1##) mount %s on %v failed "+
"with smb mapping failed with error: rpc error: code = Unknown desc = NewSmbGlobalMapping failed.",
errorSource, errorMountSensSource),
Expand All @@ -607,7 +609,8 @@ func TestNodeStageVolume(t *testing.T) {
{"blkid", []string{"-p", "-s", "TYPE", "-s", "PTTYPE", "-o", "export", testDiskPath}, "", &testingexec.FakeExitError{Status: 2}},
{"mkfs.ext4", []string{"-F", "-m0", testDiskPath}, "", fmt.Errorf("formatting failed")},
},
skipOnDarwin: true,
skipOnDarwin: true,
skipOnWindows: true,
flakyWindowsErrorMessage: fmt.Sprintf("volume(vol_1##) mount %s on %v failed with "+
"smb mapping failed with error: rpc error: code = Unknown desc = NewSmbGlobalMapping failed.",
errorSource, proxyMountPath),
Expand All @@ -621,6 +624,7 @@ func TestNodeStageVolume(t *testing.T) {
VolumeCapability: &stdVolCap,
VolumeContext: volContext,
Secrets: secrets},
skipOnWindows: true,
flakyWindowsErrorMessage: fmt.Sprintf("volume(vol_1##) mount %s on %v failed with "+
"smb mapping failed with error: rpc error: code = Unknown desc = NewSmbGlobalMapping failed.",
errorSource, sourceTest),
Expand All @@ -632,6 +636,7 @@ func TestNodeStageVolume(t *testing.T) {
VolumeCapability: &stdVolCap,
VolumeContext: volContextEmptyShareName,
Secrets: secrets},
skipOnWindows: true,
flakyWindowsErrorMessage: fmt.Sprintf("volume(vol_1##) mount \\\\k8s.file.test_suffix\\test_sharename on %v failed with "+
"smb mapping failed with error: rpc error: code = Unknown desc = NewSmbGlobalMapping failed.",
sourceTest),
Expand All @@ -643,6 +648,7 @@ func TestNodeStageVolume(t *testing.T) {
VolumeCapability: &stdVolCap,
VolumeContext: volContextNfs,
Secrets: secrets},
skipOnWindows: true,
flakyWindowsErrorMessage: fmt.Sprintf("volume(vol_1##) mount %s on %v failed with "+
"smb mapping failed with error: rpc error: code = Unknown desc = NewSmbGlobalMapping failed.",
errorSource, sourceTest),
Expand All @@ -654,6 +660,7 @@ func TestNodeStageVolume(t *testing.T) {
VolumeCapability: &stdVolCap,
VolumeContext: volContextFsType,
Secrets: secrets},
skipOnWindows: true,
execScripts: []ExecArgs{
{"blkid", []string{"-p", "-s", "TYPE", "-s", "PTTYPE", "-o", "export", testDiskPath}, "", nil},
{"mkfs.ext4", []string{"-F", "-m0", testDiskPath}, "", nil},
Expand All @@ -669,6 +676,7 @@ func TestNodeStageVolume(t *testing.T) {
VolumeCapability: &groupVolCap,
VolumeContext: volContextFsType,
Secrets: secrets},
skipOnWindows: true,
execScripts: []ExecArgs{
{"blkid", []string{"-p", "-s", "TYPE", "-s", "PTTYPE", "-o", "export", testDiskPath}, "", nil},
{"mkfs.ext4", []string{"-F", "-m0", testDiskPath}, "", nil},
Expand Down Expand Up @@ -703,6 +711,9 @@ func TestNodeStageVolume(t *testing.T) {
if test.skipOnDarwin && runtime.GOOS == "darwin" {
continue
}
if test.skipOnWindows && runtime.GOOS == "windows" {
continue
}
mounter, err := NewFakeMounter()
if err != nil {
t.Fatalf(fmt.Sprintf("failed to get fake mounter: %v", err))
Expand Down

0 comments on commit 6c1c3cc

Please sign in to comment.