@@ -35,6 +35,7 @@ import (
35
35
"k8s.io/mount-utils"
36
36
"sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/pkg/deviceutils"
37
37
metadataservice "sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/pkg/gce-cloud-provider/metadata"
38
+ "sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/pkg/linkcache"
38
39
mountmanager "sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/pkg/mount-manager"
39
40
)
40
41
@@ -45,11 +46,13 @@ const (
45
46
)
46
47
47
48
func getTestGCEDriver (t * testing.T ) * GCEDriver {
48
- return getCustomTestGCEDriver (t , mountmanager .NewFakeSafeMounter (), deviceutils .NewFakeDeviceUtils (false ), metadataservice .NewFakeService (), & NodeServerArgs {})
49
+ return getCustomTestGCEDriver (t , mountmanager .NewFakeSafeMounter (), deviceutils .NewFakeDeviceUtils (false ), metadataservice .NewFakeService (), & NodeServerArgs {
50
+ DeviceCache : linkcache .TestDeviceCache (1 * time .Minute , linkcache .TestNodeWithVolumes ([]string {defaultVolumeID })),
51
+ })
49
52
}
50
53
51
- func getTestGCEDriverWithCustomMounter (t * testing.T , mounter * mount.SafeFormatAndMount ) * GCEDriver {
52
- return getCustomTestGCEDriver (t , mounter , deviceutils .NewFakeDeviceUtils (false ), metadataservice .NewFakeService (), & NodeServerArgs {} )
54
+ func getTestGCEDriverWithCustomMounter (t * testing.T , mounter * mount.SafeFormatAndMount , args * NodeServerArgs ) * GCEDriver {
55
+ return getCustomTestGCEDriver (t , mounter , deviceutils .NewFakeDeviceUtils (false ), metadataservice .NewFakeService (), args )
53
56
}
54
57
55
58
func getCustomTestGCEDriver (t * testing.T , mounter * mount.SafeFormatAndMount , deviceUtils deviceutils.DeviceUtils , metaService metadataservice.MetadataService , args * NodeServerArgs ) * GCEDriver {
@@ -189,7 +192,9 @@ func TestNodeGetVolumeStats(t *testing.T) {
189
192
}
190
193
191
194
mounter := mountmanager .NewFakeSafeMounterWithCustomExec (& testingexec.FakeExec {CommandScript : actionList })
192
- gceDriver := getTestGCEDriverWithCustomMounter (t , mounter )
195
+ gceDriver := getTestGCEDriverWithCustomMounter (t , mounter , & NodeServerArgs {
196
+ DeviceCache : linkcache .TestDeviceCache (1 * time .Minute , linkcache .TestNodeWithVolumes ([]string {tc .volumeID })),
197
+ })
193
198
ns := gceDriver .ns
194
199
195
200
req := & csi.NodeGetVolumeStatsRequest {
@@ -1246,7 +1251,9 @@ func TestNodeStageVolume(t *testing.T) {
1246
1251
))
1247
1252
}
1248
1253
mounter := mountmanager .NewFakeSafeMounterWithCustomExec (& testingexec.FakeExec {CommandScript : actionList , ExactOrder : true })
1249
- gceDriver := getTestGCEDriverWithCustomMounter (t , mounter )
1254
+ gceDriver := getTestGCEDriverWithCustomMounter (t , mounter , & NodeServerArgs {
1255
+ DeviceCache : linkcache .TestDeviceCache (1 * time .Minute , linkcache .TestNodeWithVolumes ([]string {volumeID })),
1256
+ })
1250
1257
ns := gceDriver .ns
1251
1258
ns .SysfsPath = tempDir + "/sys"
1252
1259
_ , err := ns .NodeStageVolume (context .Background (), tc .req )
0 commit comments