Skip to content

Commit bd68f80

Browse files
Merge pull request #2100 from abays/fix/dataplane-webhook-reconcile-race
test(dataplane): wait for initial deployment reconcile
2 parents f486f67 + d8e2adb commit bd68f80

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎test/functional/dataplane/openstackdataplanedeployment_webhook_test.go‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,23 @@ var _ = Describe("DataplaneDeployment Webhook", func() {
3232
Expect(th.K8sClient.Update(th.Ctx, instance)).To(Succeed())
3333
Expect(th.K8sClient.Delete(th.Ctx, instance)).To(Succeed())
3434
})
35+
36+
// Let the deployment controller finish its initial reconcile before the
37+
// tests set a synthetic status. The initial reconcile initializes the
38+
// deployment conditions and would otherwise race with delete validation.
39+
Eventually(func(g Gomega) {
40+
instance := &dataplanev1.OpenStackDataPlaneDeployment{}
41+
g.Expect(th.K8sClient.Get(th.Ctx, name, instance)).To(Succeed())
42+
g.Expect(instance.Status.ObservedGeneration).To(Equal(instance.Generation))
43+
}, timeout, interval).Should(Succeed())
3544
}
3645

3746
setDeploymentRunning := func(name types.NamespacedName) {
3847
Eventually(func(g Gomega) error {
3948
instance := &dataplanev1.OpenStackDataPlaneDeployment{}
4049
g.Expect(th.K8sClient.Get(th.Ctx, name, instance)).To(Succeed())
50+
// Prevent the controller's delayed retry from overwriting this synthetic condition.
51+
instance.Status.Deployed = true
4152
instance.Status.Conditions = condition.Conditions{}
4253
instance.Status.Conditions.MarkFalse(
4354
condition.DeploymentReadyCondition,
@@ -53,6 +64,7 @@ var _ = Describe("DataplaneDeployment Webhook", func() {
5364
Eventually(func(g Gomega) error {
5465
instance := &dataplanev1.OpenStackDataPlaneDeployment{}
5566
g.Expect(th.K8sClient.Get(th.Ctx, name, instance)).To(Succeed())
67+
instance.Status.Deployed = true
5668
instance.Status.Conditions = condition.Conditions{}
5769
instance.Status.Conditions.MarkTrue(
5870
condition.DeploymentReadyCondition,

0 commit comments

Comments
 (0)