@@ -28,6 +28,7 @@ import (
28
28
29
29
"github.com/container-storage-interface/spec/lib/go/csi"
30
30
"github.com/golang/mock/gomock"
31
+ "github.com/kubernetes-csi/csi-test/v5/utils"
31
32
"google.golang.org/grpc"
32
33
"google.golang.org/grpc/codes"
33
34
"google.golang.org/grpc/status"
@@ -170,7 +171,7 @@ func TestGetPluginName(t *testing.T) {
170
171
in := & csi.GetPluginInfoRequest {}
171
172
out := test .output [0 ]
172
173
173
- identityServer .EXPECT ().GetPluginInfo (gomock .Any (), in ).Return (out , nil ).Times (1 )
174
+ identityServer .EXPECT ().GetPluginInfo (gomock .Any (), utils . Protobuf ( in ) ).Return (out , nil ).Times (1 )
174
175
oldName , err := GetDriverName (csiConn .conn , timeout )
175
176
if err != nil {
176
177
t .Errorf ("test %q: Failed to get driver's name" , test .name )
@@ -180,7 +181,7 @@ func TestGetPluginName(t *testing.T) {
180
181
}
181
182
182
183
out = test .output [1 ]
183
- identityServer .EXPECT ().GetPluginInfo (gomock .Any (), in ).Return (out , nil ).Times (1 )
184
+ identityServer .EXPECT ().GetPluginInfo (gomock .Any (), utils . Protobuf ( in ) ).Return (out , nil ).Times (1 )
184
185
newName , err := GetDriverName (csiConn .conn , timeout )
185
186
if err != nil {
186
187
t .Errorf ("test %s: Failed to get driver's name" , test .name )
@@ -351,7 +352,7 @@ func TestGetDriverName(t *testing.T) {
351
352
}
352
353
353
354
// Setup expectation
354
- identityServer .EXPECT ().GetPluginInfo (gomock .Any (), in ).Return (out , injectedErr ).Times (1 )
355
+ identityServer .EXPECT ().GetPluginInfo (gomock .Any (), utils . Protobuf ( in ) ).Return (out , injectedErr ).Times (1 )
355
356
356
357
name , err := GetDriverName (csiConn .conn , timeout )
357
358
if test .expectError && err == nil {
@@ -450,9 +451,9 @@ func TestCreateDriverReturnsInvalidCapacityDuringProvision(t *testing.T) {
450
451
// Set up Mocks
451
452
controllerServer .EXPECT ().CreateVolume (gomock .Any (), gomock .Any ()).Return (out , nil ).Times (1 )
452
453
// Since capacity returned by driver is invalid, we expect the provision call to clean up the volume
453
- controllerServer .EXPECT ().DeleteVolume (gomock .Any (), & csi.DeleteVolumeRequest {
454
+ controllerServer .EXPECT ().DeleteVolume (gomock .Any (), utils . Protobuf ( & csi.DeleteVolumeRequest {
454
455
VolumeId : "test-volume-id" ,
455
- }).Return (& csi.DeleteVolumeResponse {}, nil ).Times (1 )
456
+ })) .Return (& csi.DeleteVolumeResponse {}, nil ).Times (1 )
456
457
457
458
// Call provision
458
459
_ , _ , err = csiProvisioner .Provision (context .Background (), opts )
@@ -2279,7 +2280,7 @@ func provisionTestcases() (int64, map[string]provisioningTestcase) {
2279
2280
},
2280
2281
expectErr : true ,
2281
2282
expectState : controller .ProvisioningNoChange ,
2282
- expectNoProvision : true , // not owner yet
2283
+ expectNoProvision : true , // notowner yet
2283
2284
expectSelectedNode : nodeFoo .Name , // changed by ShouldProvision
2284
2285
},
2285
2286
"distributed immediate, allowed topologies not okay" : {
@@ -4558,9 +4559,9 @@ func TestProvisionFromSnapshot(t *testing.T) {
4558
4559
if tc .notPopulated {
4559
4560
out .Volume .ContentSource = nil
4560
4561
controllerServer .EXPECT ().CreateVolume (gomock .Any (), gomock .Any ()).Return (out , nil ).Times (1 )
4561
- controllerServer .EXPECT ().DeleteVolume (gomock .Any (), & csi.DeleteVolumeRequest {
4562
+ controllerServer .EXPECT ().DeleteVolume (gomock .Any (), utils . Protobuf ( & csi.DeleteVolumeRequest {
4562
4563
VolumeId : "test-volume-id" ,
4563
- }).Return (& csi.DeleteVolumeResponse {}, nil ).Times (1 )
4564
+ })) .Return (& csi.DeleteVolumeResponse {}, nil ).Times (1 )
4564
4565
} else {
4565
4566
snapshotSource := csi.VolumeContentSource_Snapshot {
4566
4567
Snapshot : & csi.VolumeContentSource_SnapshotSource {
@@ -5539,7 +5540,7 @@ func runDeleteTest(t *testing.T, k string, tc deleteTestcase) {
5539
5540
nodeDeployment = & NodeDeployment {
5540
5541
NodeName : tc .deploymentNode ,
5541
5542
ClaimInformer : claimInformer ,
5542
- NodeInfo : csi.NodeGetInfoResponse {
5543
+ NodeInfo : & csi.NodeGetInfoResponse {
5543
5544
NodeId : tc .deploymentNode ,
5544
5545
AccessibleTopology : & csi.Topology {
5545
5546
Segments : map [string ]string {
@@ -6659,9 +6660,9 @@ func TestProvisionFromPVC(t *testing.T) {
6659
6660
controllerServer .EXPECT ().CreateVolume (gomock .Any (), gomock .Any ()).Return (out , nil ).Times (1 )
6660
6661
// if the volume created is less than the requested size,
6661
6662
// deletevolume will be called
6662
- controllerServer .EXPECT ().DeleteVolume (gomock .Any (), & csi.DeleteVolumeRequest {
6663
+ controllerServer .EXPECT ().DeleteVolume (gomock .Any (), utils . Protobuf ( & csi.DeleteVolumeRequest {
6663
6664
VolumeId : "test-volume-id" ,
6664
- }).Return (& csi.DeleteVolumeResponse {}, nil ).Times (1 )
6665
+ })) .Return (& csi.DeleteVolumeResponse {}, nil ).Times (1 )
6665
6666
}
6666
6667
6667
6668
_ , _ , _ , claimLister , _ , _ := listers (clientSet )
@@ -6838,14 +6839,14 @@ func TestProvisionWithMigration(t *testing.T) {
6838
6839
expectParams [translatedKey ] = "foo"
6839
6840
}
6840
6841
controllerServer .EXPECT ().CreateVolume (gomock .Any (),
6841
- & csi.CreateVolumeRequest {
6842
+ utils . Protobuf ( & csi.CreateVolumeRequest {
6842
6843
Name : "test-testi" ,
6843
6844
Parameters : expectParams ,
6844
6845
VolumeCapabilities : nil ,
6845
6846
CapacityRange : & csi.CapacityRange {
6846
6847
RequiredBytes : int64 (requestBytes ),
6847
6848
},
6848
- }).Return (
6849
+ })) .Return (
6849
6850
& csi.CreateVolumeResponse {
6850
6851
Volume : & csi.Volume {
6851
6852
CapacityBytes : requestBytes ,
@@ -6997,9 +6998,9 @@ func TestDeleteMigration(t *testing.T) {
6997
6998
// We assert that the Delete is called on the driver with either the
6998
6999
// normal or the translated handle
6999
7000
controllerServer .EXPECT ().DeleteVolume (gomock .Any (),
7000
- & csi.DeleteVolumeRequest {
7001
+ utils . Protobuf ( & csi.DeleteVolumeRequest {
7001
7002
VolumeId : volID ,
7002
- }).Return (& csi.DeleteVolumeResponse {}, nil ).Times (1 )
7003
+ })) .Return (& csi.DeleteVolumeResponse {}, nil ).Times (1 )
7003
7004
7004
7005
// Run Delete
7005
7006
err = csiProvisioner .Delete (context .Background (), tc .pv )
0 commit comments