@@ -3,9 +3,11 @@ package client
33import (
44 "context"
55 "fmt"
6+ "net/http"
67
78 . "github.com/onsi/ginkgo/v2"
89 . "github.com/onsi/gomega"
10+ oapiError "github.com/stackitcloud/stackit-sdk-go/core/oapierror"
911 iaas "github.com/stackitcloud/stackit-sdk-go/services/iaas/v2api"
1012 "go.uber.org/mock/gomock"
1113
@@ -40,7 +42,8 @@ var _ = Describe("Server", func() {
4042 It ("returns a server on success" , func () {
4143 mockIaaSClient .EXPECT ().
4244 GetServer (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any ()).
43- Return (& iaas.Server {Id : new (serverID ), Name : "my-server" }, nil )
45+ Return (iaas.ApiGetServerRequest {ApiService : mockIaaSClient })
46+ mockIaaSClient .EXPECT ().GetServerExecute (gomock .Any ()).Return (& iaas.Server {Id : new (serverID ), Name : "my-server" }, nil )
4447
4548 server , err := client .GetServer (context .Background (), "my-server" )
4649 Expect (err ).ToNot (HaveOccurred ())
@@ -50,7 +53,10 @@ var _ = Describe("Server", func() {
5053 It ("returns ErrorNotFound when API returns 404" , func () {
5154 mockIaaSClient .EXPECT ().
5255 GetServer (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any ()).
53- Return (nil , ErrorNotFound )
56+ Return (iaas.ApiGetServerRequest {ApiService : mockIaaSClient })
57+ mockIaaSClient .EXPECT ().GetServerExecute (gomock .Any ()).Return (nil , & oapiError.GenericOpenAPIError {
58+ StatusCode : http .StatusNotFound ,
59+ })
5460
5561 _ , err := client .GetServer (context .Background (), "my-server" )
5662 Expect (err ).To (HaveOccurred ())
@@ -61,8 +67,10 @@ var _ = Describe("Server", func() {
6167 It ("successfully creates a server" , func () {
6268 mockIaaSClient .EXPECT ().
6369 CreateServer (gomock .Any (), gomock .Any (), gomock .Any ()).
64- Return (iaas.Server {
65- Id : new (serverID ), Name : "new-server" }, nil )
70+ Return (iaas.ApiCreateServerRequest {ApiService : mockIaaSClient })
71+ mockIaaSClient .EXPECT ().CreateServerExecute (gomock .Any ()).Return (& iaas.Server {
72+ Id : new (serverID ), Name : "new-server" }, nil )
73+
6674 payload := & iaas.CreateServerPayload {Name : "new-server" }
6775
6876 server , err := client .CreateServer (context .Background (), payload )
@@ -75,7 +83,8 @@ var _ = Describe("Server", func() {
7583 It ("deletes the server successfully" , func () {
7684 mockIaaSClient .EXPECT ().
7785 DeleteServer (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any ()).
78- Return (nil )
86+ Return (iaas.ApiDeleteServerRequest {ApiService : mockIaaSClient })
87+ mockIaaSClient .EXPECT ().DeleteServerExecute (gomock .Any ()).Return (nil )
7988
8089 err := client .DeleteServer (context .Background (), serverID )
8190 Expect (err ).ToNot (HaveOccurred ())
@@ -90,11 +99,11 @@ var _ = Describe("Server", func() {
9099
91100 mockIaaSClient .EXPECT ().
92101 ListServers (gomock .Any (), gomock .Any (), gomock .Any ()).
93- Return (& iaas.ServerListResponse {Items : mockItems }, nil )
102+ Return (iaas.ApiListServersRequest {ApiService : mockIaaSClient })
103+ mockIaaSClient .EXPECT ().ListServersExecute (gomock .Any ()).Return (& iaas.ServerListResponse {Items : mockItems }, nil )
94104
95105 resp , err := client .ListServers (context .Background ())
96106 Expect (err ).ToNot (HaveOccurred ())
97- Expect (resp ).To (HaveLen (1 ))
98107 items := * resp
99108 Expect (items ).To (HaveLen (1 ))
100109 Expect (* items [0 ].Id ).To (Equal ("id-1" ))
@@ -105,7 +114,8 @@ var _ = Describe("Server", func() {
105114 It ("updates server properties" , func () {
106115 mockIaaSClient .EXPECT ().
107116 UpdateServer (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any ()).
108- Return (& iaas.Server {Id : new (serverID ), Name : "updated-name" }, nil )
117+ Return (iaas.ApiUpdateServerRequest {ApiService : mockIaaSClient })
118+ mockIaaSClient .EXPECT ().UpdateServerExecute (gomock .Any ()).Return (& iaas.Server {Id : new (serverID ), Name : "updated-name" }, nil )
109119
110120 updatePayload := iaas.UpdateServerPayload {Name : new ("updated - name ")}
111121 server , err := client .UpdateServer (context .Background (), serverID , updatePayload )
@@ -143,7 +153,8 @@ var _ = Describe("Snapshot", func() {
143153 It ("successfully creates a snapshot" , func () {
144154 mockIaaSClient .EXPECT ().
145155 CreateSnapshot (gomock .Any (), gomock .Any (), gomock .Any ()).
146- Return (& iaas.Snapshot {Id : new (snapshotID )}, nil )
156+ Return (iaas.ApiCreateSnapshotRequest {ApiService : mockIaaSClient })
157+ mockIaaSClient .EXPECT ().CreateSnapshotExecute (gomock .Any ()).Return (& iaas.Snapshot {Id : new (snapshotID )}, nil )
147158
148159 payload := & iaas.CreateSnapshotPayload {Name : new ("new - snapshot ")}
149160 snapshot , err := client .CreateSnapshot (context .Background (), payload )
@@ -154,14 +165,17 @@ var _ = Describe("Snapshot", func() {
154165
155166 Context ("ListSnapshots" , func () {
156167 It ("returns a filtered list of snapshots" , func () {
157- mockItems := []iaas.Snapshot {
158- {Id : new ("id - 1 "), Name : new ("snap - 1 ")},
159- {Id : new ("id - 2 "), Name : new ("snap - 2 ")},
168+ mockItems := & iaas.SnapshotListResponse {
169+ Items : []iaas.Snapshot {
170+ {Id : new ("id - 1 "), Name : new ("snap - 1 ")},
171+ {Id : new ("id - 2 "), Name : new ("snap - 2 ")},
172+ },
160173 }
161174
162175 mockIaaSClient .EXPECT ().
163176 ListSnapshotsInProject (gomock .Any (), gomock .Any (), gomock .Any ()).
164- Return (& iaas.SnapshotListResponse {Items : mockItems }, nil )
177+ Return (iaas.ApiListSnapshotsInProjectRequest {ApiService : mockIaaSClient })
178+ mockIaaSClient .EXPECT ().ListSnapshotsInProjectExecute (gomock .Any ()).Return (mockItems , nil )
165179
166180 resp , err := client .ListSnapshots (context .Background (), nil )
167181 Expect (err ).ToNot (HaveOccurred ())
@@ -173,7 +187,8 @@ var _ = Describe("Snapshot", func() {
173187 It ("returns a specific snapshot on success" , func () {
174188 mockIaaSClient .EXPECT ().
175189 GetSnapshot (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any ()).
176- Return (& iaas.Snapshot {Id : new (snapshotID ), Status : new ("AVAILABLE ")}, nil )
190+ Return (iaas.ApiGetSnapshotRequest {ApiService : mockIaaSClient })
191+ mockIaaSClient .EXPECT ().GetSnapshotExecute (gomock .Any ()).Return (& iaas.Snapshot {Id : new (snapshotID ), Status : new ("AVAILABLE ")}, nil )
177192
178193 snapshot , err := client .GetSnapshot (context .Background (), snapshotID )
179194 Expect (err ).ToNot (HaveOccurred ())
@@ -185,7 +200,8 @@ var _ = Describe("Snapshot", func() {
185200 It ("deletes the snapshot successfully" , func () {
186201 mockIaaSClient .EXPECT ().
187202 DeleteSnapshot (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any ()).
188- Return (nil )
203+ Return (iaas.ApiDeleteSnapshotRequest {ApiService : mockIaaSClient })
204+ mockIaaSClient .EXPECT ().DeleteSnapshotExecute (gomock .Any ()).Return (nil )
189205
190206 err := client .DeleteSnapshot (context .Background (), snapshotID )
191207 Expect (err ).ToNot (HaveOccurred ())
@@ -196,7 +212,8 @@ var _ = Describe("Snapshot", func() {
196212 It ("returns the current status of the snapshot" , func () {
197213 mockIaaSClient .EXPECT ().
198214 GetSnapshot (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any ()).
199- Return (& iaas.Snapshot {Id : new (snapshotID ), Status : new ("READY ")}, nil )
215+ Return (iaas.ApiGetSnapshotRequest {ApiService : mockIaaSClient })
216+ mockIaaSClient .EXPECT ().GetSnapshotExecute (gomock .Any ()).Return (& iaas.Snapshot {Id : new (snapshotID ), Status : new ("READY ")}, nil )
200217
201218 status , err := client .WaitSnapshotReady (context .Background (), snapshotID )
202219 Expect (err ).ToNot (HaveOccurred ())
@@ -206,7 +223,8 @@ var _ = Describe("Snapshot", func() {
206223 It ("returns an error if the snapshot retrieval fails" , func () {
207224 mockIaaSClient .EXPECT ().
208225 GetSnapshot (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any ()).
209- Return (nil , fmt .Errorf ("api error" ))
226+ Return (iaas.ApiGetSnapshotRequest {ApiService : mockIaaSClient })
227+ mockIaaSClient .EXPECT ().GetSnapshotExecute (gomock .Any ()).Return (nil , fmt .Errorf ("api error" ))
210228
211229 status , err := client .WaitSnapshotReady (context .Background (), snapshotID )
212230 Expect (err ).To (HaveOccurred ())
@@ -259,7 +277,8 @@ var _ = Describe("Backup", func() {
259277 It ("returns backup on successful API call" , func () {
260278 mockIaaSClient .EXPECT ().
261279 CreateBackup (gomock .Any (), gomock .Any (), gomock .Any ()).
262- Return (& iaas.Backup {Id : new ("expected - backup - id ")}, nil )
280+ Return (iaas.ApiCreateBackupRequest {ApiService : mockIaaSClient })
281+ mockIaaSClient .EXPECT ().CreateBackupExecute (gomock .Any ()).Return (& iaas.Backup {Id : new ("expected - backup - id ")}, nil )
263282
264283 backup , err := client .CreateBackup (context .Background (), "expected-name" , "volume-id" , "" , nil )
265284
@@ -270,7 +289,8 @@ var _ = Describe("Backup", func() {
270289 It ("returns error when API fails" , func () {
271290 mockIaaSClient .EXPECT ().
272291 CreateBackup (gomock .Any (), gomock .Any (), gomock .Any ()).
273- Return (nil , fmt .Errorf ("API error" ))
292+ Return (iaas.ApiCreateBackupRequest {ApiService : mockIaaSClient })
293+ mockIaaSClient .EXPECT ().CreateBackupExecute (gomock .Any ()).Return (nil , fmt .Errorf ("API error" ))
274294
275295 _ , err := client .CreateBackup (context .Background (), "expected-name" , "volume-id" , "" , nil )
276296 Expect (err ).To (HaveOccurred ())
@@ -289,7 +309,8 @@ var _ = Describe("Backup", func() {
289309
290310 mockIaaSClient .EXPECT ().
291311 ListBackups (gomock .Any (), gomock .Any (), gomock .Any ()).
292- Return (mockBackups .Items , nil )
312+ Return (iaas.ApiListBackupsRequest {ApiService : mockIaaSClient })
313+ mockIaaSClient .EXPECT ().ListBackupsExecute (gomock .Any ()).Return (mockBackups , nil )
293314
294315 backups , err := client .ListBackups (context .Background (), nil )
295316
@@ -301,7 +322,8 @@ var _ = Describe("Backup", func() {
301322 It ("returns error when list API fails" , func () {
302323 mockIaaSClient .EXPECT ().
303324 ListBackups (gomock .Any (), gomock .Any (), gomock .Any ()).
304- Return (nil , fmt .Errorf ("list error" ))
325+ Return (iaas.ApiListBackupsRequest {ApiService : mockIaaSClient })
326+ mockIaaSClient .EXPECT ().ListBackupsExecute (gomock .Any ()).Return (nil , fmt .Errorf ("execute error" ))
305327
306328 _ , err := client .ListBackups (context .Background (), nil )
307329 Expect (err ).To (HaveOccurred ())
@@ -312,7 +334,8 @@ var _ = Describe("Backup", func() {
312334 It ("returns a specific backup" , func () {
313335 mockIaaSClient .EXPECT ().
314336 GetBackup (gomock .Any (), gomock .Any (), gomock .Any (), "backup-id" ).
315- Return (& iaas.Backup {Id : new ("backup - id ")}, nil )
337+ Return (iaas.ApiGetBackupRequest {ApiService : mockIaaSClient })
338+ mockIaaSClient .EXPECT ().GetBackupExecute (gomock .Any ()).Return (& iaas.Backup {Id : new ("backup - id ")}, nil )
316339
317340 backup , err := client .GetBackup (context .Background (), "backup-id" )
318341 Expect (err ).ToNot (HaveOccurred ())
@@ -324,7 +347,8 @@ var _ = Describe("Backup", func() {
324347 It ("calls delete successfully" , func () {
325348 mockIaaSClient .EXPECT ().
326349 DeleteBackup (gomock .Any (), gomock .Any (), gomock .Any (), "backup-id" ).
327- Return (nil )
350+ Return (iaas.ApiDeleteBackupRequest {ApiService : mockIaaSClient })
351+ mockIaaSClient .EXPECT ().DeleteBackupExecute (gomock .Any ()).Return (nil )
328352
329353 err := client .DeleteBackup (context .Background (), "backup-id" )
330354 Expect (err ).ToNot (HaveOccurred ())
@@ -333,7 +357,8 @@ var _ = Describe("Backup", func() {
333357 It ("returns error if delete fails" , func () {
334358 mockIaaSClient .EXPECT ().
335359 DeleteBackup (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any ()).
336- Return (fmt .Errorf ("delete failed" ))
360+ Return (iaas.ApiDeleteBackupRequest {ApiService : mockIaaSClient })
361+ mockIaaSClient .EXPECT ().DeleteBackupExecute (gomock .Any ()).Return (fmt .Errorf ("delete failed" ))
337362
338363 err := client .DeleteBackup (context .Background (), "any-id" )
339364 Expect (err ).To (HaveOccurred ())
@@ -343,19 +368,20 @@ var _ = Describe("Backup", func() {
343368 Context ("WaitBackupReady" , func () {
344369 It ("returns the backup status when it becomes ready" , func () {
345370 mockIaaSClient .EXPECT ().
346- GetBackup (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any ()).
347- Return (& iaas.Backup {Id : new ("backup - id "), Status : new ("Ready ")}, nil )
348-
349- status , err := client .WaitBackupReady (context .Background (), "backup-id" , 10 , 60 )
371+ GetBackup (gomock .Any (), gomock .Any (), gomock .Any (), "backup-id" ).
372+ Return (iaas.ApiGetBackupRequest {ApiService : mockIaaSClient }).AnyTimes ()
373+ mockIaaSClient .EXPECT ().GetBackupExecute (gomock .Any ()).Return (& iaas.Backup {Id : new ("backup - id "), Status : new (backupReadyStatus )}, nil ).AnyTimes ()
350374
375+ status , err := client .WaitBackupReady (context .Background (), "backup-id" , 1 , 1 )
351376 Expect (err ).ToNot (HaveOccurred ())
352- Expect (* status ).To (Equal ("Ready" ))
377+ Expect (* status ).To (Equal (backupReadyStatus ))
353378 })
354379
355380 It ("returns error on timeout or wait failure" , func () {
356381 mockIaaSClient .EXPECT ().
357382 GetBackup (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any ()).
358- Return (nil , fmt .Errorf ("timeout waiting for backup" ))
383+ Return (iaas.ApiGetBackupRequest {ApiService : mockIaaSClient })
384+ mockIaaSClient .EXPECT ().GetBackupExecute (gomock .Any ()).Return (nil , fmt .Errorf ("timeout waiting for backup" ))
359385
360386 status , err := client .WaitBackupReady (context .Background (), "id" , 1 , 1 )
361387 Expect (err ).To (HaveOccurred ())
@@ -393,29 +419,29 @@ var _ = Describe("Volume", func() {
393419
394420 Context ("Volume Lifecycle" , func () {
395421 It ("CreateVolume successfully calls the API" , func () {
396- mockIaaSClient .EXPECT ().
397- CreateVolume ( gomock . Any (), gomock . Any (), gomock . Any ()).
398- Return (& iaas.Volume {Id : new (volumeID )}, nil )
422+ mockIaaSClient .EXPECT ().CreateVolume ( gomock . Any (), gomock . Any (), gomock . Any ()).
423+ Return (iaas. ApiCreateVolumeRequest { ApiService : mockIaaSClient })
424+ mockIaaSClient . EXPECT (). CreateVolumeExecute ( gomock . Any ()). Return (& iaas.Volume {Id : new (volumeID )}, nil )
399425
400426 vol , err := client .CreateVolume (context .Background (), & iaas.CreateVolumePayload {})
401427 Expect (err ).ToNot (HaveOccurred ())
402428 Expect (* vol .Id ).To (Equal (volumeID ))
403429 })
404430
405431 It ("GetVolume returns a specific volume" , func () {
406- mockIaaSClient .EXPECT ().
407- GetVolume ( gomock . Any (), gomock . Any (), gomock . Any (), gomock . Any ()).
408- Return (& iaas.Volume {Id : new (volumeID ), Name : new ("test - vol ")}, nil )
432+ mockIaaSClient .EXPECT ().GetVolume ( gomock . Any (), gomock . Any (), gomock . Any (), gomock . Any ()).
433+ Return (iaas. ApiGetVolumeRequest { ApiService : mockIaaSClient })
434+ mockIaaSClient . EXPECT (). GetVolumeExecute ( gomock . Any ()). Return (& iaas.Volume {Id : new (volumeID ), Name : new ("test - vol ")}, nil )
409435
410436 vol , err := client .GetVolume (context .Background (), volumeID )
411437 Expect (err ).ToNot (HaveOccurred ())
412438 Expect (* vol .Name ).To (Equal ("test-vol" ))
413439 })
414440
415441 It ("DeleteVolume fails if volume is still attached (diskIsUsed logic)" , func () {
416- mockIaaSClient .EXPECT ().
417- GetVolume ( gomock . Any (), gomock . Any (), gomock . Any (), gomock . Any ()).
418- Return (& iaas.Volume {Id : new (volumeID ), ServerId : new (serverID )}, nil )
442+ mockIaaSClient .EXPECT ().GetVolume ( gomock . Any (), gomock . Any (), gomock . Any (), gomock . Any ()).
443+ Return (iaas. ApiGetVolumeRequest { ApiService : mockIaaSClient })
444+ mockIaaSClient . EXPECT (). GetVolumeExecute ( gomock . Any ()). Return (& iaas.Volume {Id : new (volumeID ), ServerId : new (serverID )}, nil )
419445
420446 err := client .DeleteVolume (context .Background (), volumeID )
421447 Expect (err ).To (HaveOccurred ())
@@ -425,8 +451,14 @@ var _ = Describe("Volume", func() {
425451
426452 Context ("Attach/Detach Volume" , func () {
427453 It ("AttachVolume calls API when not already attached" , func () {
428- mockIaaSClient .EXPECT ().GetVolume (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any ()).
429- Return (& iaas.Volume {Id : new (volumeID ), ServerId : nil }, nil )
454+ mockIaaSClient .EXPECT ().GetVolume (gomock .Any (), gomock .Any (), gomock .Any (), volumeID ).
455+ Return (iaas.ApiGetVolumeRequest {ApiService : mockIaaSClient })
456+ mockIaaSClient .EXPECT ().GetVolumeExecute (gomock .Any ()).Return (& iaas.Volume {Id : new (volumeID ), ServerId : nil }, nil )
457+
458+ mockIaaSClient .EXPECT ().AddVolumeToServer (gomock .Any (), gomock .Any (), gomock .Any (), serverID , volumeID ).
459+ Return (iaas.ApiAddVolumeToServerRequest {ApiService : mockIaaSClient })
460+ mockIaaSClient .EXPECT ().AddVolumeToServerExecute (gomock .Any ()).Return (
461+ & iaas.VolumeAttachment {VolumeId : new (volumeID ), ServerId : new (serverID )}, nil )
430462
431463 id , err := client .AttachVolume (context .Background (), serverID , volumeID , iaas.AddVolumeToServerPayload {})
432464 Expect (err ).ToNot (HaveOccurred ())
@@ -435,7 +467,8 @@ var _ = Describe("Volume", func() {
435467
436468 It ("DetachVolume fails if status is not Available" , func () {
437469 mockIaaSClient .EXPECT ().GetVolume (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any ()).
438- Return (& iaas.Volume {Id : new (volumeID ), Status : new ("CREATING ")}, nil )
470+ Return (iaas.ApiGetVolumeRequest {ApiService : mockIaaSClient })
471+ mockIaaSClient .EXPECT ().GetVolumeExecute (gomock .Any ()).Return (& iaas.Volume {Name : new ("volume - 1 "), Id : new (volumeID ), Status : new ("CREATING ")}, nil )
439472
440473 err := client .DetachVolume (context .Background (), serverID , volumeID )
441474 Expect (err ).To (HaveOccurred ())
@@ -447,17 +480,14 @@ var _ = Describe("Volume", func() {
447480 It ("successfully resizes an Available volume" , func () {
448481 mockIaaSClient .EXPECT ().
449482 ResizeVolume (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any ()).
450- Return (nil )
483+ Return (iaas.ApiResizeVolumeRequest {ApiService : mockIaaSClient })
484+ mockIaaSClient .EXPECT ().ResizeVolumeExecute (gomock .Any ()).Return (nil )
451485
452- err := client .ExpandVolume (context .Background (), volumeID , "available" , iaas.ResizeVolumePayload {})
486+ err := client .ExpandVolume (context .Background (), volumeID , VolumeAvailableStatus , iaas.ResizeVolumePayload {})
453487 Expect (err ).ToNot (HaveOccurred ())
454488 })
455489
456490 It ("errors when volume is in a bad state for resize" , func () {
457- mockIaaSClient .EXPECT ().
458- ResizeVolume (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any ()).
459- Return (fmt .Errorf ("volume cannot be resized, when status is %s" , "ERROR" ))
460-
461491 err := client .ExpandVolume (context .Background (), volumeID , "ERROR" , iaas.ResizeVolumePayload {})
462492 Expect (err ).To (HaveOccurred ())
463493 Expect (err .Error ()).To (ContainSubstring ("cannot be resized" ))
@@ -466,19 +496,22 @@ var _ = Describe("Volume", func() {
466496
467497 Context ("Waiting Logic" , func () {
468498 It ("WaitVolumeTargetStatus returns nil when target status is reached" , func () {
469- // Mocking the behavior of WaitVolumeTargetStatus
470499 mockIaaSClient .EXPECT ().
471- GetVolume (gomock .Any (), volumeID , []string {"available" }, gomock .Any ()).
472- Return (nil )
500+ GetVolume (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any ()).
501+ Return (iaas.ApiGetVolumeRequest {ApiService : mockIaaSClient })
502+ mockIaaSClient .EXPECT ().GetVolumeExecute (gomock .Any ()).Return (& iaas.Volume {Id : new (volumeID ), Status : new ("available ")}, nil )
473503
474504 err := client .WaitVolumeTargetStatus (context .Background (), volumeID , []string {"available" })
475505 Expect (err ).ToNot (HaveOccurred ())
476506 })
477507
478508 It ("WaitDiskAttached returns error on timeout" , func () {
479509 mockIaaSClient .EXPECT ().
480- GetVolume (gomock .Any (), serverID , volumeID , gomock .Any ()).
481- Return (fmt .Errorf ("timeout" ))
510+ GetVolume (gomock .Any (), gomock .Any (), gomock .Any (), gomock .Any ()).
511+ Return (iaas.ApiGetVolumeRequest {
512+ ApiService : mockIaaSClient ,
513+ })
514+ mockIaaSClient .EXPECT ().GetVolumeExecute (gomock .Any ()).Return (nil , fmt .Errorf ("timeout" ))
482515
483516 err := client .WaitDiskAttached (context .Background (), serverID , volumeID )
484517 Expect (err ).To (HaveOccurred ())
0 commit comments