@@ -237,20 +237,22 @@ func TestFetchMigInstancesInstanceUrlHandling(t *testing.T) {
237
237
name string
238
238
lmiResponse gce_api.InstanceGroupManagersListManagedInstancesResponse
239
239
lmiPageResponses map [string ]gce_api.InstanceGroupManagersListManagedInstancesResponse
240
- wantInstances []cloudprovider. Instance
240
+ wantInstances []GceInstance
241
241
}{
242
242
{
243
243
name : "all instances good" ,
244
244
lmiResponse : gce_api.InstanceGroupManagersListManagedInstancesResponse {
245
245
ManagedInstances : []* gce_api.ManagedInstance {
246
246
{
247
+ Id : 2 ,
247
248
Instance : fmt .Sprintf (goodInstanceUrlTempl , 2 ),
248
249
CurrentAction : "CREATING" ,
249
250
LastAttempt : & gce_api.ManagedInstanceLastAttempt {
250
251
Errors : & gce_api.ManagedInstanceLastAttemptErrors {},
251
252
},
252
253
},
253
254
{
255
+ Id : 42 ,
254
256
Instance : fmt .Sprintf (goodInstanceUrlTempl , 42 ),
255
257
CurrentAction : "CREATING" ,
256
258
LastAttempt : & gce_api.ManagedInstanceLastAttempt {
@@ -259,14 +261,20 @@ func TestFetchMigInstancesInstanceUrlHandling(t *testing.T) {
259
261
},
260
262
},
261
263
},
262
- wantInstances : []cloudprovider. Instance {
264
+ wantInstances : []GceInstance {
263
265
{
264
- Id : "gce://myprojid/myzone/myinst_2" ,
265
- Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
266
+ Instance : cloudprovider.Instance {
267
+ Id : "gce://myprojid/myzone/myinst_2" ,
268
+ Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
269
+ },
270
+ NumericId : 2 ,
266
271
},
267
272
{
268
- Id : "gce://myprojid/myzone/myinst_42" ,
269
- Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
273
+ Instance : cloudprovider.Instance {
274
+ Id : "gce://myprojid/myzone/myinst_42" ,
275
+ Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
276
+ },
277
+ NumericId : 42 ,
270
278
},
271
279
},
272
280
},
@@ -275,13 +283,15 @@ func TestFetchMigInstancesInstanceUrlHandling(t *testing.T) {
275
283
lmiResponse : gce_api.InstanceGroupManagersListManagedInstancesResponse {
276
284
ManagedInstances : []* gce_api.ManagedInstance {
277
285
{
286
+ Id : 2 ,
278
287
Instance : fmt .Sprintf (goodInstanceUrlTempl , 2 ),
279
288
CurrentAction : "CREATING" ,
280
289
LastAttempt : & gce_api.ManagedInstanceLastAttempt {
281
290
Errors : & gce_api.ManagedInstanceLastAttemptErrors {},
282
291
},
283
292
},
284
293
{
294
+ Id : 42 ,
285
295
Instance : fmt .Sprintf (goodInstanceUrlTempl , 42 ),
286
296
CurrentAction : "CREATING" ,
287
297
LastAttempt : & gce_api.ManagedInstanceLastAttempt {
@@ -295,13 +305,15 @@ func TestFetchMigInstancesInstanceUrlHandling(t *testing.T) {
295
305
"foo" : {
296
306
ManagedInstances : []* gce_api.ManagedInstance {
297
307
{
308
+ Id : 123 ,
298
309
Instance : fmt .Sprintf (goodInstanceUrlTempl , 123 ),
299
310
CurrentAction : "CREATING" ,
300
311
LastAttempt : & gce_api.ManagedInstanceLastAttempt {
301
312
Errors : & gce_api.ManagedInstanceLastAttemptErrors {},
302
313
},
303
314
},
304
315
{
316
+ Id : 456 ,
305
317
Instance : fmt .Sprintf (goodInstanceUrlTempl , 456 ),
306
318
CurrentAction : "CREATING" ,
307
319
LastAttempt : & gce_api.ManagedInstanceLastAttempt {
@@ -311,22 +323,34 @@ func TestFetchMigInstancesInstanceUrlHandling(t *testing.T) {
311
323
},
312
324
},
313
325
},
314
- wantInstances : []cloudprovider. Instance {
326
+ wantInstances : []GceInstance {
315
327
{
316
- Id : "gce://myprojid/myzone/myinst_2" ,
317
- Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
328
+ Instance : cloudprovider.Instance {
329
+ Id : "gce://myprojid/myzone/myinst_2" ,
330
+ Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
331
+ },
332
+ NumericId : 2 ,
318
333
},
319
334
{
320
- Id : "gce://myprojid/myzone/myinst_42" ,
321
- Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
335
+ Instance : cloudprovider.Instance {
336
+ Id : "gce://myprojid/myzone/myinst_42" ,
337
+ Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
338
+ },
339
+ NumericId : 42 ,
322
340
},
323
341
{
324
- Id : "gce://myprojid/myzone/myinst_123" ,
325
- Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
342
+ Instance : cloudprovider.Instance {
343
+ Id : "gce://myprojid/myzone/myinst_123" ,
344
+ Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
345
+ },
346
+ NumericId : 123 ,
326
347
},
327
348
{
328
- Id : "gce://myprojid/myzone/myinst_456" ,
329
- Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
349
+ Instance : cloudprovider.Instance {
350
+ Id : "gce://myprojid/myzone/myinst_456" ,
351
+ Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
352
+ },
353
+ NumericId : 456 ,
330
354
},
331
355
},
332
356
},
@@ -335,13 +359,15 @@ func TestFetchMigInstancesInstanceUrlHandling(t *testing.T) {
335
359
lmiResponse : gce_api.InstanceGroupManagersListManagedInstancesResponse {
336
360
ManagedInstances : []* gce_api.ManagedInstance {
337
361
{
362
+ Id : 2 ,
338
363
Instance : fmt .Sprintf (goodInstanceUrlTempl , 2 ),
339
364
CurrentAction : "CREATING" ,
340
365
LastAttempt : & gce_api.ManagedInstanceLastAttempt {
341
366
Errors : & gce_api.ManagedInstanceLastAttemptErrors {},
342
367
},
343
368
},
344
369
{
370
+ Id : 42 ,
345
371
Instance : fmt .Sprintf (goodInstanceUrlTempl , 42 ),
346
372
CurrentAction : "CREATING" ,
347
373
LastAttempt : & gce_api.ManagedInstanceLastAttempt {
@@ -355,13 +381,15 @@ func TestFetchMigInstancesInstanceUrlHandling(t *testing.T) {
355
381
"foo" : {
356
382
ManagedInstances : []* gce_api.ManagedInstance {
357
383
{
384
+ Id : 123 ,
358
385
Instance : fmt .Sprintf (goodInstanceUrlTempl , 123 ),
359
386
CurrentAction : "CREATING" ,
360
387
LastAttempt : & gce_api.ManagedInstanceLastAttempt {
361
388
Errors : & gce_api.ManagedInstanceLastAttemptErrors {},
362
389
},
363
390
},
364
391
{
392
+ Id : 456 ,
365
393
Instance : fmt .Sprintf (goodInstanceUrlTempl , 456 ),
366
394
CurrentAction : "CREATING" ,
367
395
LastAttempt : & gce_api.ManagedInstanceLastAttempt {
@@ -374,13 +402,15 @@ func TestFetchMigInstancesInstanceUrlHandling(t *testing.T) {
374
402
"bar" : {
375
403
ManagedInstances : []* gce_api.ManagedInstance {
376
404
{
405
+ Id : 789 ,
377
406
Instance : fmt .Sprintf (goodInstanceUrlTempl , 789 ),
378
407
CurrentAction : "CREATING" ,
379
408
LastAttempt : & gce_api.ManagedInstanceLastAttempt {
380
409
Errors : & gce_api.ManagedInstanceLastAttemptErrors {},
381
410
},
382
411
},
383
412
{
413
+ Id : 666 ,
384
414
Instance : fmt .Sprintf (goodInstanceUrlTempl , 666 ),
385
415
CurrentAction : "CREATING" ,
386
416
LastAttempt : & gce_api.ManagedInstanceLastAttempt {
@@ -390,30 +420,48 @@ func TestFetchMigInstancesInstanceUrlHandling(t *testing.T) {
390
420
},
391
421
},
392
422
},
393
- wantInstances : []cloudprovider. Instance {
423
+ wantInstances : []GceInstance {
394
424
{
395
- Id : "gce://myprojid/myzone/myinst_2" ,
396
- Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
425
+ Instance : cloudprovider.Instance {
426
+ Id : "gce://myprojid/myzone/myinst_2" ,
427
+ Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
428
+ },
429
+ NumericId : 2 ,
397
430
},
398
431
{
399
- Id : "gce://myprojid/myzone/myinst_42" ,
400
- Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
432
+ Instance : cloudprovider.Instance {
433
+ Id : "gce://myprojid/myzone/myinst_42" ,
434
+ Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
435
+ },
436
+ NumericId : 42 ,
401
437
},
402
438
{
403
- Id : "gce://myprojid/myzone/myinst_123" ,
404
- Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
439
+ Instance : cloudprovider.Instance {
440
+ Id : "gce://myprojid/myzone/myinst_123" ,
441
+ Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
442
+ },
443
+ NumericId : 123 ,
405
444
},
406
445
{
407
- Id : "gce://myprojid/myzone/myinst_456" ,
408
- Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
446
+ Instance : cloudprovider.Instance {
447
+ Id : "gce://myprojid/myzone/myinst_456" ,
448
+ Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
449
+ },
450
+ NumericId : 456 ,
409
451
},
410
452
{
411
- Id : "gce://myprojid/myzone/myinst_789" ,
412
- Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
453
+ Instance : cloudprovider.Instance {
454
+ Id : "gce://myprojid/myzone/myinst_789" ,
455
+ Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
456
+ },
457
+ NumericId : 789 ,
413
458
},
414
459
{
415
- Id : "gce://myprojid/myzone/myinst_666" ,
416
- Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
460
+ Instance : cloudprovider.Instance {
461
+ Id : "gce://myprojid/myzone/myinst_666" ,
462
+ Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
463
+ },
464
+ NumericId : 666 ,
417
465
},
418
466
},
419
467
},
@@ -422,13 +470,15 @@ func TestFetchMigInstancesInstanceUrlHandling(t *testing.T) {
422
470
lmiResponse : gce_api.InstanceGroupManagersListManagedInstancesResponse {
423
471
ManagedInstances : []* gce_api.ManagedInstance {
424
472
{
473
+ Id : 99999 ,
425
474
Instance : badInstanceUrl ,
426
475
CurrentAction : "CREATING" ,
427
476
LastAttempt : & gce_api.ManagedInstanceLastAttempt {
428
477
Errors : & gce_api.ManagedInstanceLastAttemptErrors {},
429
478
},
430
479
},
431
480
{
481
+ Id : 42 ,
432
482
Instance : fmt .Sprintf (goodInstanceUrlTempl , 42 ),
433
483
CurrentAction : "CREATING" ,
434
484
LastAttempt : & gce_api.ManagedInstanceLastAttempt {
@@ -437,10 +487,13 @@ func TestFetchMigInstancesInstanceUrlHandling(t *testing.T) {
437
487
},
438
488
},
439
489
},
440
- wantInstances : []cloudprovider. Instance {
490
+ wantInstances : []GceInstance {
441
491
{
442
- Id : "gce://myprojid/myzone/myinst_42" ,
443
- Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
492
+ Instance : cloudprovider.Instance {
493
+ Id : "gce://myprojid/myzone/myinst_42" ,
494
+ Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
495
+ },
496
+ NumericId : 42 ,
444
497
},
445
498
},
446
499
},
@@ -456,6 +509,7 @@ func TestFetchMigInstancesInstanceUrlHandling(t *testing.T) {
456
509
},
457
510
},
458
511
{
512
+ Id : 42 ,
459
513
Instance : fmt .Sprintf (goodInstanceUrlTempl , 42 ),
460
514
CurrentAction : "CREATING" ,
461
515
LastAttempt : & gce_api.ManagedInstanceLastAttempt {
@@ -464,10 +518,13 @@ func TestFetchMigInstancesInstanceUrlHandling(t *testing.T) {
464
518
},
465
519
},
466
520
},
467
- wantInstances : []cloudprovider. Instance {
521
+ wantInstances : []GceInstance {
468
522
{
469
- Id : "gce://myprojid/myzone/myinst_42" ,
470
- Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
523
+ Instance : cloudprovider.Instance {
524
+ Id : "gce://myprojid/myzone/myinst_42" ,
525
+ Status : & cloudprovider.InstanceStatus {State : cloudprovider .InstanceCreating },
526
+ },
527
+ NumericId : 42 ,
471
528
},
472
529
},
473
530
},
0 commit comments