Skip to content

Commit ec156a9

Browse files
authored
Merge pull request #101 from mayankshah1607/mayank/fix-windows-tests
Skip unit tests in windows
2 parents 492a280 + d85b3c3 commit ec156a9

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

pkg/smb/nodeserver_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"fmt"
2323
"os"
2424
"reflect"
25+
"runtime"
2526
"syscall"
2627
"testing"
2728

@@ -37,7 +38,16 @@ const (
3738
targetTest = "./target_test"
3839
)
3940

41+
// skip test if running on windows
42+
func skipTestIfWindows(t *testing.T) {
43+
if runtime.GOOS == "windows" {
44+
t.Skip("Skipping test on Windows")
45+
}
46+
}
47+
4048
func TestNodeStageVolume(t *testing.T) {
49+
skipTestIfWindows(t)
50+
4151
stdVolCap := csi.VolumeCapability{
4252
AccessType: &csi.VolumeCapability_Mount{
4353
Mount: &csi.VolumeCapability_MountVolume{},
@@ -180,6 +190,7 @@ func TestNodeExpandVolume(t *testing.T) {
180190
}
181191

182192
func TestNodePublishVolume(t *testing.T) {
193+
skipTestIfWindows(t)
183194
volumeCap := csi.VolumeCapability_AccessMode{Mode: csi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER}
184195
errorMountSource := "./error_mount_source"
185196
alreadyMountedTarget := "./false_is_likely_exist_target"
@@ -283,6 +294,7 @@ func TestNodePublishVolume(t *testing.T) {
283294
}
284295

285296
func TestNodeUnpublishVolume(t *testing.T) {
297+
skipTestIfWindows(t)
286298
errorTarget := "./error_is_likely_target"
287299
targetFile := "./abc.go"
288300

@@ -334,6 +346,7 @@ func TestNodeUnpublishVolume(t *testing.T) {
334346
}
335347

336348
func TestNodeUnstageVolume(t *testing.T) {
349+
skipTestIfWindows(t)
337350
errorTarget := "./error_is_likely_target"
338351
targetFile := "./abc.go"
339352

pkg/smb/smb_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ func TestNewFakeDriver(t *testing.T) {
4343
}
4444

4545
func TestIsCorruptedDir(t *testing.T) {
46+
skipTestIfWindows(t)
4647
existingMountPath, err := ioutil.TempDir(os.TempDir(), "csi-mount-test")
4748
if err != nil {
4849
t.Fatalf("failed to create tmp dir: %v", err)

0 commit comments

Comments
 (0)