@@ -3,6 +3,7 @@ package driver_test
3
3
import (
4
4
"context"
5
5
"os"
6
+ "path"
6
7
"testing"
7
8
8
9
"github.com/civo/civo-csi/pkg/driver"
@@ -115,10 +116,12 @@ func TestNodePublishVolume(t *testing.T) {
115
116
hotPlugger := & driver.FakeDiskHotPlugger {}
116
117
d .DiskHotPlugger = hotPlugger
117
118
119
+ targetPath := path .Join (t .TempDir (), "some-path" )
120
+
118
121
_ , err := d .NodePublishVolume (context .Background (), & csi.NodePublishVolumeRequest {
119
122
VolumeId : "volume-1" ,
120
123
StagingTargetPath : "/mnt/my-target" ,
121
- TargetPath : "/var/lib/kubelet/some-path" ,
124
+ TargetPath : targetPath ,
122
125
VolumeCapability : & csi.VolumeCapability {
123
126
AccessType : & csi.VolumeCapability_Mount {},
124
127
AccessMode : & csi.VolumeCapability_AccessMode {
@@ -128,7 +131,7 @@ func TestNodePublishVolume(t *testing.T) {
128
131
})
129
132
assert .Nil (t , err )
130
133
131
- mounted , _ := d .DiskHotPlugger .IsMounted ("" )
134
+ mounted , _ := d .DiskHotPlugger .IsMounted (targetPath )
132
135
assert .True (t , mounted )
133
136
})
134
137
}
@@ -144,13 +147,15 @@ func TestNodeUnpublishVolume(t *testing.T) {
144
147
}
145
148
d .DiskHotPlugger = hotPlugger
146
149
150
+ targetPath := path .Join (t .TempDir (), "some-path" )
151
+
147
152
_ , err := d .NodeUnpublishVolume (context .Background (), & csi.NodeUnpublishVolumeRequest {
148
153
VolumeId : "volume-1" ,
149
- TargetPath : "/var/lib/kubelet/some-path" ,
154
+ TargetPath : targetPath ,
150
155
})
151
156
assert .Nil (t , err )
152
157
153
- mounted , _ := d .DiskHotPlugger .IsMounted ("/var/lib/kubelet/some-path" )
158
+ mounted , _ := d .DiskHotPlugger .IsMounted (targetPath )
154
159
assert .False (t , mounted )
155
160
})
156
161
}
0 commit comments