@@ -22,6 +22,7 @@ import (
2222 "fmt"
2323 "os"
2424 "reflect"
25+ "runtime"
2526 "syscall"
2627 "testing"
2728
@@ -125,7 +126,13 @@ func TestEnsureMountPoint(t *testing.T) {
125126
126127func TestNodePublishVolume (t * testing.T ) {
127128 volumeCap := csi.VolumeCapability_AccessMode {Mode : csi .VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER }
128-
129+ createDirError := status .Errorf (codes .Internal ,
130+ "Could not mount target \" ./azure.go\" : mkdir ./azure.go: not a directory" )
131+ if runtime .GOOS == "windows" {
132+ createDirError = status .Errorf (codes .Internal ,
133+ "Could not mount target \" ./azure.go\" : mkdir ./azure.go: " +
134+ "The system cannot find the path specified." )
135+ }
129136 tests := []struct {
130137 desc string
131138 req csi.NodePublishVolumeRequest
@@ -170,7 +177,7 @@ func TestNodePublishVolume(t *testing.T) {
170177 TargetPath : "./azure.go" ,
171178 StagingTargetPath : sourceTest ,
172179 Readonly : true },
173- expectedErr : status . Errorf ( codes . Internal , "Could not mount target \" ./azure.go \" : mkdir ./azure.go: not a directory" ) ,
180+ expectedErr : createDirError ,
174181 },
175182 {
176183 desc : "Error mounting resource busy" ,
@@ -198,7 +205,7 @@ func TestNodePublishVolume(t *testing.T) {
198205 _ , err := d .NodePublishVolume (context .Background (), & test .req )
199206
200207 if ! reflect .DeepEqual (err , test .expectedErr ) {
201- t .Errorf ("Unexpected error: %v" , err )
208+ t .Errorf ("Desc: %s - Unexpected error: %v - Expected: %v " , test . desc , err , test . expectedErr )
202209 }
203210 }
204211
0 commit comments