@@ -293,13 +293,11 @@ var _ = Describe("operator upgrade", Label("upgrade"), func() {
293293 Namespace : namespace ,
294294 }
295295
296- var expectedGeneration int64
297296 Eventually (func () error {
298297 sts := & appsv1.StatefulSet {}
299298 getErr := k8sClient .Get (ctx , childNSN , sts )
300299 if getErr == nil {
301300 tc .stsSpec = sts .Spec .DeepCopy ()
302- expectedGeneration = sts .Generation
303301 }
304302 return getErr
305303 }, 5 * time .Minute , 5 * time .Second ).ShouldNot (HaveOccurred ())
@@ -322,10 +320,7 @@ var _ = Describe("operator upgrade", Label("upgrade"), func() {
322320 Consistently (func () string {
323321 var s appsv1.StatefulSet
324322 Expect (k8sClient .Get (ctx , childNSN , & s )).ToNot (HaveOccurred ())
325- if s .Generation != expectedGeneration {
326- return cmp .Diff (* tc .stsSpec , s .Spec )
327- }
328- return ""
323+ return cmp .Diff (* tc .stsSpec , s .Spec )
329324 }, 15 * time .Second , 5 * time .Second ).Should (BeEmpty ())
330325 },
331326 Entry ("from v0.64.0" , "v0.64.0" , func (cr * vmv1beta1.VMAgent ) {}),
@@ -388,11 +383,10 @@ var _ = Describe("operator upgrade", Label("upgrade"), func() {
388383 }, 5 * time .Minute , 5 * time .Second ).ShouldNot (HaveOccurred ())
389384 tc .depSpec = * dep .Spec .DeepCopy ()
390385 expectedDepSpec := sanitizeDeploymentSpec (tc .depSpec .DeepCopy ())
391- expectedGeneration := dep .Generation
392386
393387 removeOldOperator (ctx , k8sClient , namespace )
394388
395- _ , _ = startNewOperator (ctx )
389+ startNewOperator (ctx )
396390 DeferCleanup (func () {
397391 defer GinkgoRecover ()
398392
@@ -412,11 +406,8 @@ var _ = Describe("operator upgrade", Label("upgrade"), func() {
412406 Consistently (func () string {
413407 var d appsv1.Deployment
414408 Expect (k8sClient .Get (ctx , childNSN , & d )).ToNot (HaveOccurred ())
415- if d .Generation != expectedGeneration {
416- s := sanitizeDeploymentSpec (d .Spec .DeepCopy ())
417- return cmp .Diff (* expectedDepSpec , * s )
418- }
419- return ""
409+ s := sanitizeDeploymentSpec (d .Spec .DeepCopy ())
410+ return cmp .Diff (* expectedDepSpec , * s )
420411 }, 15 * time .Second , 5 * time .Second ).Should (BeEmpty ())
421412 },
422413 Entry ("from v0.64.0" , "v0.64.0" , func (cr * vmv1beta1.VMSingle ) {
@@ -490,7 +481,6 @@ var _ = Describe("operator upgrade", Label("upgrade"), func() {
490481 return k8sClient .Get (ctx , childNSN , & dep )
491482 }, 5 * time .Minute , 5 * time .Second ).ShouldNot (HaveOccurred ())
492483 tc .depSpec = dep .Spec .DeepCopy ()
493- expectedGeneration := dep .Generation
494484
495485 removeOldOperator (ctx , k8sClient , namespace )
496486
@@ -510,12 +500,9 @@ var _ = Describe("operator upgrade", Label("upgrade"), func() {
510500 Consistently (func () string {
511501 var d appsv1.Deployment
512502 Expect (k8sClient .Get (ctx , childNSN , & d )).ToNot (HaveOccurred ())
513- if d .Generation != expectedGeneration {
514- s := sanitizeDeploymentSpec (d .Spec .DeepCopy ())
515- expectedDepSpec := sanitizeDeploymentSpec (tc .depSpec .DeepCopy ())
516- return cmp .Diff (* expectedDepSpec , * s )
517- }
518- return ""
503+ s := sanitizeDeploymentSpec (d .Spec .DeepCopy ())
504+ expectedDepSpec := sanitizeDeploymentSpec (tc .depSpec .DeepCopy ())
505+ return cmp .Diff (* expectedDepSpec , * s )
519506 }, 15 * time .Second , 5 * time .Second ).Should (BeEmpty ())
520507 },
521508 Entry ("from v0.64.0" , "v0.64.0" , func (cr * vmv1beta1.VMAuth ) {}),
@@ -584,7 +571,6 @@ var _ = Describe("operator upgrade", Label("upgrade"), func() {
584571 return k8sClient .Get (ctx , childNSN , & dep )
585572 }, 5 * time .Minute , 5 * time .Second ).ShouldNot (HaveOccurred ())
586573 tc .depSpec = dep .Spec .DeepCopy ()
587- expectedGeneration := dep .Generation
588574
589575 removeOldOperator (ctx , k8sClient , namespace )
590576
@@ -604,12 +590,9 @@ var _ = Describe("operator upgrade", Label("upgrade"), func() {
604590 Consistently (func () string {
605591 var d appsv1.Deployment
606592 Expect (k8sClient .Get (ctx , childNSN , & d )).ToNot (HaveOccurred ())
607- if d .Generation != expectedGeneration {
608- s := sanitizeDeploymentSpec (d .Spec .DeepCopy ())
609- expectedDepSpec := sanitizeDeploymentSpec (tc .depSpec .DeepCopy ())
610- return cmp .Diff (* expectedDepSpec , * s )
611- }
612- return ""
593+ s := sanitizeDeploymentSpec (d .Spec .DeepCopy ())
594+ expectedDepSpec := sanitizeDeploymentSpec (tc .depSpec .DeepCopy ())
595+ return cmp .Diff (* expectedDepSpec , * s )
613596 }, 15 * time .Second , 5 * time .Second ).Should (BeEmpty ())
614597 },
615598 Entry ("from v0.64.0" , "v0.64.0" , func (cr * vmv1beta1.VMAlert ) {}),
@@ -694,7 +677,6 @@ var _ = Describe("operator upgrade", Label("upgrade"), func() {
694677 }, 5 * time .Minute , 5 * time .Second ).ShouldNot (HaveOccurred ())
695678 tc .insertDepSpec = * insertDep .Spec .DeepCopy ()
696679 expectedInsertDepSpec := sanitizeDeploymentSpec (tc .insertDepSpec .DeepCopy ())
697- expectedInsertGeneration := insertDep .Generation
698680
699681 selectNSN := types.NamespacedName {
700682 Name : fmt .Sprintf ("vmselect-%s" , vmclusterName ),
@@ -706,7 +688,6 @@ var _ = Describe("operator upgrade", Label("upgrade"), func() {
706688 }, 5 * time .Minute , 5 * time .Second ).ShouldNot (HaveOccurred ())
707689 tc .selectDepSpec = * selectSTS .Spec .DeepCopy ()
708690 expectedSelectDepSpec := tc .selectDepSpec .DeepCopy ()
709- expectedSelectGeneration := selectSTS .Generation
710691
711692 storageNSN := types.NamespacedName {
712693 Name : fmt .Sprintf ("vmstorage-%s" , vmclusterName ),
@@ -717,12 +698,10 @@ var _ = Describe("operator upgrade", Label("upgrade"), func() {
717698 return k8sClient .Get (ctx , storageNSN , & storageSts )
718699 }, 5 * time .Minute , 5 * time .Second ).ShouldNot (HaveOccurred ())
719700 tc .storageStsSpec = * storageSts .Spec .DeepCopy ()
720- expectedStorageStsSpec := tc .storageStsSpec .DeepCopy ()
721- expectedStorageGeneration := storageSts .Generation
722701
723702 removeOldOperator (ctx , k8sClient , namespace )
724703
725- _ , _ = startNewOperator (ctx )
704+ startNewOperator (ctx )
726705 DeferCleanup (func () {
727706 defer GinkgoRecover ()
728707
@@ -748,22 +727,25 @@ var _ = Describe("operator upgrade", Label("upgrade"), func() {
748727 Consistently (func () string {
749728 var d appsv1.Deployment
750729 Expect (k8sClient .Get (ctx , insertNSN , & d )).ToNot (HaveOccurred ())
751- if d .Generation != expectedInsertGeneration {
752- s := sanitizeDeploymentSpec (d .Spec .DeepCopy ())
753- return "insert:\n " + cmp .Diff (* expectedInsertDepSpec , * s )
730+ s := sanitizeDeploymentSpec (d .Spec .DeepCopy ())
731+ diff := cmp .Diff (* expectedInsertDepSpec , * s )
732+ if diff != "" {
733+ return "insert:\n " + diff
754734 }
755735
756736 var sts appsv1.StatefulSet
757737 Expect (k8sClient .Get (ctx , selectNSN , & sts )).ToNot (HaveOccurred ())
758- if sts .Generation != expectedSelectGeneration {
759- s := sts .Spec .DeepCopy ()
760- return "select:\n " + cmp .Diff (* expectedSelectDepSpec , * s )
738+ stsSpec := sts .Spec .DeepCopy ()
739+ diff = cmp .Diff (* expectedSelectDepSpec , * stsSpec )
740+ if diff != "" {
741+ return "select:\n " + diff
761742 }
762743
763744 Expect (k8sClient .Get (ctx , storageNSN , & sts )).ToNot (HaveOccurred ())
764- if sts .Generation != expectedStorageGeneration {
765- s := sts .Spec .DeepCopy ()
766- return "storage:\n " + cmp .Diff (* expectedStorageStsSpec , * s )
745+ stsSpec = sts .Spec .DeepCopy ()
746+ diff = cmp .Diff (* expectedSelectDepSpec , * stsSpec )
747+ if diff != "" {
748+ return "select:\n " + diff
767749 }
768750 return ""
769751 }, 15 * time .Second , 5 * time .Second ).Should (BeEmpty ())
0 commit comments