@@ -34,6 +34,7 @@ import (
34
34
"k8s.io/mount-utils"
35
35
"sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/pkg/deviceutils"
36
36
metadataservice "sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/pkg/gce-cloud-provider/metadata"
37
+ "sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/pkg/linkcache"
37
38
mountmanager "sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/pkg/mount-manager"
38
39
)
39
40
@@ -44,11 +45,13 @@ const (
44
45
)
45
46
46
47
func getTestGCEDriver (t * testing.T ) * GCEDriver {
47
- return getCustomTestGCEDriver (t , mountmanager .NewFakeSafeMounter (), deviceutils .NewFakeDeviceUtils (false ), metadataservice .NewFakeService (), & NodeServerArgs {})
48
+ return getCustomTestGCEDriver (t , mountmanager .NewFakeSafeMounter (), deviceutils .NewFakeDeviceUtils (false ), metadataservice .NewFakeService (), & NodeServerArgs {
49
+ DeviceCache : linkcache .TestDeviceCache (1 * time .Minute , linkcache .TestNodeWithVolumes ([]string {defaultVolumeID })),
50
+ })
48
51
}
49
52
50
- func getTestGCEDriverWithCustomMounter (t * testing.T , mounter * mount.SafeFormatAndMount ) * GCEDriver {
51
- return getCustomTestGCEDriver (t , mounter , deviceutils .NewFakeDeviceUtils (false ), metadataservice .NewFakeService (), & NodeServerArgs {} )
53
+ func getTestGCEDriverWithCustomMounter (t * testing.T , mounter * mount.SafeFormatAndMount , args * NodeServerArgs ) * GCEDriver {
54
+ return getCustomTestGCEDriver (t , mounter , deviceutils .NewFakeDeviceUtils (false ), metadataservice .NewFakeService (), args )
52
55
}
53
56
54
57
func getCustomTestGCEDriver (t * testing.T , mounter * mount.SafeFormatAndMount , deviceUtils deviceutils.DeviceUtils , metaService metadataservice.MetadataService , args * NodeServerArgs ) * GCEDriver {
@@ -188,7 +191,9 @@ func TestNodeGetVolumeStats(t *testing.T) {
188
191
}
189
192
190
193
mounter := mountmanager .NewFakeSafeMounterWithCustomExec (& testingexec.FakeExec {CommandScript : actionList })
191
- gceDriver := getTestGCEDriverWithCustomMounter (t , mounter )
194
+ gceDriver := getTestGCEDriverWithCustomMounter (t , mounter , & NodeServerArgs {
195
+ DeviceCache : linkcache .TestDeviceCache (1 * time .Minute , linkcache .TestNodeWithVolumes ([]string {tc .volumeID })),
196
+ })
192
197
ns := gceDriver .ns
193
198
194
199
req := & csi.NodeGetVolumeStatsRequest {
@@ -1142,7 +1147,9 @@ func TestNodeStageVolume(t *testing.T) {
1142
1147
))
1143
1148
}
1144
1149
mounter := mountmanager .NewFakeSafeMounterWithCustomExec (& testingexec.FakeExec {CommandScript : actionList , ExactOrder : true })
1145
- gceDriver := getTestGCEDriverWithCustomMounter (t , mounter )
1150
+ gceDriver := getTestGCEDriverWithCustomMounter (t , mounter , & NodeServerArgs {
1151
+ DeviceCache : linkcache .TestDeviceCache (1 * time .Minute , linkcache .TestNodeWithVolumes ([]string {volumeID })),
1152
+ })
1146
1153
ns := gceDriver .ns
1147
1154
ns .SysfsPath = tempDir + "/sys"
1148
1155
_ , err := ns .NodeStageVolume (context .Background (), tc .req )
0 commit comments