@@ -28,6 +28,7 @@ import (
2828
2929 "github.com/container-storage-interface/spec/lib/go/csi"
3030 "github.com/golang/mock/gomock"
31+ "github.com/kubernetes-csi/csi-test/v5/utils"
3132 "google.golang.org/grpc"
3233 "google.golang.org/grpc/codes"
3334 "google.golang.org/grpc/status"
@@ -170,7 +171,7 @@ func TestGetPluginName(t *testing.T) {
170171 in := & csi.GetPluginInfoRequest {}
171172 out := test .output [0 ]
172173
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 )
174175 oldName , err := GetDriverName (csiConn .conn , timeout )
175176 if err != nil {
176177 t .Errorf ("test %q: Failed to get driver's name" , test .name )
@@ -180,7 +181,7 @@ func TestGetPluginName(t *testing.T) {
180181 }
181182
182183 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 )
184185 newName , err := GetDriverName (csiConn .conn , timeout )
185186 if err != nil {
186187 t .Errorf ("test %s: Failed to get driver's name" , test .name )
@@ -351,7 +352,7 @@ func TestGetDriverName(t *testing.T) {
351352 }
352353
353354 // 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 )
355356
356357 name , err := GetDriverName (csiConn .conn , timeout )
357358 if test .expectError && err == nil {
@@ -450,9 +451,9 @@ func TestCreateDriverReturnsInvalidCapacityDuringProvision(t *testing.T) {
450451 // Set up Mocks
451452 controllerServer .EXPECT ().CreateVolume (gomock .Any (), gomock .Any ()).Return (out , nil ).Times (1 )
452453 // 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 {
454455 VolumeId : "test-volume-id" ,
455- }).Return (& csi.DeleteVolumeResponse {}, nil ).Times (1 )
456+ })) .Return (& csi.DeleteVolumeResponse {}, nil ).Times (1 )
456457
457458 // Call provision
458459 _ , _ , err = csiProvisioner .Provision (context .Background (), opts )
@@ -2279,7 +2280,7 @@ func provisionTestcases() (int64, map[string]provisioningTestcase) {
22792280 },
22802281 expectErr : true ,
22812282 expectState : controller .ProvisioningNoChange ,
2282- expectNoProvision : true , // not owner yet
2283+ expectNoProvision : true , // notowner yet
22832284 expectSelectedNode : nodeFoo .Name , // changed by ShouldProvision
22842285 },
22852286 "distributed immediate, allowed topologies not okay" : {
@@ -4558,9 +4559,9 @@ func TestProvisionFromSnapshot(t *testing.T) {
45584559 if tc .notPopulated {
45594560 out .Volume .ContentSource = nil
45604561 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 {
45624563 VolumeId : "test-volume-id" ,
4563- }).Return (& csi.DeleteVolumeResponse {}, nil ).Times (1 )
4564+ })) .Return (& csi.DeleteVolumeResponse {}, nil ).Times (1 )
45644565 } else {
45654566 snapshotSource := csi.VolumeContentSource_Snapshot {
45664567 Snapshot : & csi.VolumeContentSource_SnapshotSource {
@@ -5539,7 +5540,7 @@ func runDeleteTest(t *testing.T, k string, tc deleteTestcase) {
55395540 nodeDeployment = & NodeDeployment {
55405541 NodeName : tc .deploymentNode ,
55415542 ClaimInformer : claimInformer ,
5542- NodeInfo : csi.NodeGetInfoResponse {
5543+ NodeInfo : & csi.NodeGetInfoResponse {
55435544 NodeId : tc .deploymentNode ,
55445545 AccessibleTopology : & csi.Topology {
55455546 Segments : map [string ]string {
@@ -6659,9 +6660,9 @@ func TestProvisionFromPVC(t *testing.T) {
66596660 controllerServer .EXPECT ().CreateVolume (gomock .Any (), gomock .Any ()).Return (out , nil ).Times (1 )
66606661 // if the volume created is less than the requested size,
66616662 // deletevolume will be called
6662- controllerServer .EXPECT ().DeleteVolume (gomock .Any (), & csi.DeleteVolumeRequest {
6663+ controllerServer .EXPECT ().DeleteVolume (gomock .Any (), utils . Protobuf ( & csi.DeleteVolumeRequest {
66636664 VolumeId : "test-volume-id" ,
6664- }).Return (& csi.DeleteVolumeResponse {}, nil ).Times (1 )
6665+ })) .Return (& csi.DeleteVolumeResponse {}, nil ).Times (1 )
66656666 }
66666667
66676668 _ , _ , _ , claimLister , _ , _ := listers (clientSet )
@@ -6838,14 +6839,14 @@ func TestProvisionWithMigration(t *testing.T) {
68386839 expectParams [translatedKey ] = "foo"
68396840 }
68406841 controllerServer .EXPECT ().CreateVolume (gomock .Any (),
6841- & csi.CreateVolumeRequest {
6842+ utils . Protobuf ( & csi.CreateVolumeRequest {
68426843 Name : "test-testi" ,
68436844 Parameters : expectParams ,
68446845 VolumeCapabilities : nil ,
68456846 CapacityRange : & csi.CapacityRange {
68466847 RequiredBytes : int64 (requestBytes ),
68476848 },
6848- }).Return (
6849+ })) .Return (
68496850 & csi.CreateVolumeResponse {
68506851 Volume : & csi.Volume {
68516852 CapacityBytes : requestBytes ,
@@ -6997,9 +6998,9 @@ func TestDeleteMigration(t *testing.T) {
69976998 // We assert that the Delete is called on the driver with either the
69986999 // normal or the translated handle
69997000 controllerServer .EXPECT ().DeleteVolume (gomock .Any (),
7000- & csi.DeleteVolumeRequest {
7001+ utils . Protobuf ( & csi.DeleteVolumeRequest {
70017002 VolumeId : volID ,
7002- }).Return (& csi.DeleteVolumeResponse {}, nil ).Times (1 )
7003+ })) .Return (& csi.DeleteVolumeResponse {}, nil ).Times (1 )
70037004
70047005 // Run Delete
70057006 err = csiProvisioner .Delete (context .Background (), tc .pv )
0 commit comments