Skip to content

Commit

Permalink
test: fix windows test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
andyzhangx committed Jul 18, 2024
1 parent 308d326 commit c3e36cc
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions pkg/smb/controllerserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -849,19 +849,20 @@ func TestCopyFromVolume(t *testing.T) {
}

for _, test := range cases {
test := test //pin
t.Run(test.desc, func(t *testing.T) {
// Setup
_ = os.MkdirAll(filepath.Join(d.workingMountDir, testCSIVolume, testCSIVolume), os.ModePerm)
if test.desc == "valid copy" && runtime.GOOS == "windows" {
t.Skip("Skipping test on Windows")
}

err := d.copyFromVolume(context.TODO(), test.req, test.dstVol)
if runtime.GOOS == "windows" {
fmt.Println("Skipping checks on Windows ENV") // nolint
} else {
if !reflect.DeepEqual(err, test.expectErr) {
t.Errorf("[test: %s] Unexpected error: %v, expected error: %v", test.desc, err, test.expectErr)
}
// Setup
_ = os.MkdirAll(filepath.Join(d.workingMountDir, testCSIVolume, testCSIVolume), os.ModePerm)

err := d.copyFromVolume(context.TODO(), test.req, test.dstVol)
if runtime.GOOS == "windows" {
fmt.Println("Skipping checks on Windows ENV") // nolint
} else {
if !reflect.DeepEqual(err, test.expectErr) {
t.Errorf("[test: %s] Unexpected error: %v, expected error: %v", test.desc, err, test.expectErr)
}
})
}
}
}

0 comments on commit c3e36cc

Please sign in to comment.