Skip to content

Commit

Permalink
Fix observed generation test (#346)
Browse files Browse the repository at this point in the history
* Fix observed generation test

* Fix test behaviour

* remove outdated comment
  • Loading branch information
wilwell authored Sep 17, 2024
1 parent eb352d3 commit 54143b9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/e2e/ytsaurus_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,6 @@ func getSimpleUpdateScenario(namespace, newImage string) func(ctx context.Contex
DeferCleanup(deleteYtsaurus, ytsaurus)
name := types.NamespacedName{Name: ytsaurus.GetName(), Namespace: namespace}
deployAndCheck(ytsaurus, namespace)
oldGeneration := ytsaurus.ObjectMeta.Generation

By("Run cluster update")
podsBeforeUpdate := getComponentPods(ctx, namespace)
Expand All @@ -1117,10 +1116,14 @@ func getSimpleUpdateScenario(namespace, newImage string) func(ctx context.Contex

podsAfterFullUpdate := getComponentPods(ctx, namespace)
podDiff := diffPodsCreation(podsBeforeUpdate, podsAfterFullUpdate)
newYt := ytv1.Ytsaurus{}
err := k8sClient.Get(ctx, name, &newYt)
Expect(err).Should(Succeed())

Expect(podDiff.created.IsEmpty()).To(BeTrue(), "unexpected pod diff created %v", podDiff.created)
Expect(podDiff.deleted.IsEmpty()).To(BeTrue(), "unexpected pod diff deleted %v", podDiff.deleted)
Expect(podDiff.recreated.Equal(NewStringSetFromMap(podsBeforeUpdate))).To(BeTrue(), "unexpected pod diff recreated %v", podDiff.recreated)
Expect(ytsaurus.ObjectMeta.Generation).To(Equal(oldGeneration + 1))
Expect(newYt.Status.ObservedGeneration).To(Equal(newYt.Generation))
}
}

Expand Down

0 comments on commit 54143b9

Please sign in to comment.