@@ -346,7 +346,7 @@ func TestIsUpdatingPods(t *testing.T) {
346
346
{
347
347
Name : "containerB" ,
348
348
Image : "2048" ,
349
- ImageID : "123456 " ,
349
+ ImageID : "12345 " ,
350
350
},
351
351
},
352
352
},
@@ -407,14 +407,15 @@ func TestIsUpdatingPods(t *testing.T) {
407
407
{
408
408
Name : "containerB" ,
409
409
Image : "2048" ,
410
- ImageID : "123456 " ,
410
+ ImageID : "12345 " ,
411
411
},
412
412
},
413
413
},
414
414
}
415
415
pod3 := & corev1.Pod {
416
416
ObjectMeta : metav1.ObjectMeta {
417
- Labels : map [string ]string {tappv1 .TAppInstanceKey : "3" },
417
+ Labels : map [string ]string {tappv1 .TAppInstanceKey : "3" },
418
+ Annotations : map [string ]string {InPlaceUpdateStateKey : InPlaceUpdateStateValue },
418
419
},
419
420
Spec : corev1.PodSpec {
420
421
Containers : []corev1.Container {
@@ -433,8 +434,40 @@ func TestIsUpdatingPods(t *testing.T) {
433
434
{
434
435
Name : "containerA" ,
435
436
Image : "docker.io/nginx:1.7.9" ,
437
+ ImageID : "1234567" ,
438
+ },
439
+ {
440
+ Name : "containerB" ,
441
+ Image : "2048:latest" ,
436
442
ImageID : "123456" ,
437
443
},
444
+ },
445
+ },
446
+ }
447
+ pod4 := & corev1.Pod {
448
+ ObjectMeta : metav1.ObjectMeta {
449
+ Labels : map [string ]string {tappv1 .TAppInstanceKey : "4" },
450
+ Annotations : map [string ]string {InPlaceUpdateStateKey : InPlaceUpdateStateValue },
451
+ },
452
+ Spec : corev1.PodSpec {
453
+ Containers : []corev1.Container {
454
+ {
455
+ Name : "containerA" ,
456
+ Image : "nginx:1.7.9" ,
457
+ },
458
+ {
459
+ Name : "containerB" ,
460
+ Image : "2048" ,
461
+ },
462
+ },
463
+ },
464
+ Status : corev1.PodStatus {
465
+ ContainerStatuses : []corev1.ContainerStatus {
466
+ {
467
+ Name : "containerA" ,
468
+ Image : "nginx" ,
469
+ ImageID : "1234567" ,
470
+ },
438
471
{
439
472
Name : "containerB" ,
440
473
Image : "2048:latest" ,
@@ -443,8 +476,8 @@ func TestIsUpdatingPods(t *testing.T) {
443
476
},
444
477
},
445
478
}
446
- pods := []* corev1.Pod {pod0 , pod1 , pod2 , pod3 }
447
- expectedUpdating := map [string ]bool {"1" : true , "2 " : true }
479
+ pods := []* corev1.Pod {pod0 , pod1 , pod2 , pod3 , pod4 }
480
+ expectedUpdating := map [string ]bool {"4 " : true }
448
481
updating := getUpdatingPods (pods )
449
482
if ! reflect .DeepEqual (expectedUpdating , updating ) {
450
483
t .Errorf ("Failed to getUpdatingPods, expected: %+v, got: %+v" , expectedUpdating , updating )
0 commit comments