@@ -36,7 +36,7 @@ func TestFilesystemAPIGroup(t *testing.T) {
36
36
r1 := rand .New (s1 )
37
37
38
38
// simulate FS operations around staging a volume on a node
39
- stagepath := fmt .Sprintf ("C: \\ var \\ lib \\ kubelet \\ plugins \\ testplugin-%d.csi.io\\ volume%d" , r1 .Intn (100 ), r1 .Intn (100 ))
39
+ stagepath := getWorkDirPath ( fmt .Sprintf ("testplugin-%d.csi.io\\ volume%d" , r1 .Intn (100 ), r1 .Intn (100 )), t )
40
40
mkdirReq := & v1beta1.MkdirRequest {
41
41
Path : stagepath ,
42
42
Context : v1beta1 .PathContext_PLUGIN ,
@@ -50,7 +50,7 @@ func TestFilesystemAPIGroup(t *testing.T) {
50
50
assert .True (t , exists , err )
51
51
52
52
// simulate operations around publishing a volume to a pod
53
- podpath := fmt .Sprintf ("C: \\ var \\ lib \\ kubelet \\ pods \\ test-pod-id\\ volumes\\ kubernetes.io~csi\\ pvc-test%d" , r1 .Intn (100 ))
53
+ podpath := getWorkDirPath ( fmt .Sprintf ("test-pod-id\\ volumes\\ kubernetes.io~csi\\ pvc-test%d" , r1 .Intn (100 )), t )
54
54
mkdirReq = & v1beta1.MkdirRequest {
55
55
Path : podpath ,
56
56
Context : v1beta1 .PathContext_POD ,
@@ -109,18 +109,18 @@ func TestFilesystemAPIGroup(t *testing.T) {
109
109
rand1 := r1 .Intn (100 )
110
110
rand2 := r1 .Intn (100 )
111
111
112
- testDir := fmt .Sprintf ("C: \\ var \\ lib \\ kubelet \\ plugins \\ testplugin-%d.csi.io" , rand1 )
112
+ testDir := getWorkDirPath ( fmt .Sprintf ("testplugin-%d.csi.io" , rand1 ), t )
113
113
err = os .MkdirAll (testDir , os .ModeDir )
114
114
require .Nil (t , err )
115
115
defer os .RemoveAll (testDir )
116
116
117
117
// 1. Check the isMount on a path which does not exist. Failure scenario.
118
- stagepath := fmt .Sprintf ("C: \\ var \\ lib \\ kubelet \\ plugins \\ testplugin-%d.csi.io\\ volume%d" , rand1 , rand2 )
118
+ stagepath := getWorkDirPath ( fmt .Sprintf ("testplugin-%d.csi.io\\ volume%d" , rand1 , rand2 ), t )
119
119
isMountRequest := & v1beta1.IsMountPointRequest {
120
120
Path : stagepath ,
121
121
}
122
122
isMountResponse , err := client .IsMountPoint (context .Background (), isMountRequest )
123
- require .Nil (t , err )
123
+ require .NotNil (t , err )
124
124
125
125
// 2. Create the directory. This time its not a mount point. Failure scenario.
126
126
err = os .Mkdir (stagepath , os .ModeDir )
@@ -135,8 +135,8 @@ func TestFilesystemAPIGroup(t *testing.T) {
135
135
136
136
err = os .Remove (stagepath )
137
137
require .Nil (t , err )
138
- targetStagePath := fmt .Sprintf ("C: \\ var \\ lib \\ kubelet \\ plugins \\ testplugin-%d.csi.io\\ volume%d-tgt" , rand1 , rand2 )
139
- lnTargetStagePath := fmt .Sprintf ("C: \\ var \\ lib \\ kubelet \\ plugins \\ testplugin-%d.csi.io\\ volume%d-tgt-ln" , rand1 , rand2 )
138
+ targetStagePath := getWorkDirPath ( fmt .Sprintf ("testplugin-%d.csi.io\\ volume%d-tgt" , rand1 , rand2 ), t )
139
+ lnTargetStagePath := getWorkDirPath ( fmt .Sprintf ("testplugin-%d.csi.io\\ volume%d-tgt-ln" , rand1 , rand2 ), t )
140
140
141
141
// 3. Create soft link to the directory and make sure target exists. Success scenario.
142
142
err = os .Mkdir (targetStagePath , os .ModeDir )
0 commit comments