diff --git a/test/flux_source_test.go b/test/flux_source_test.go index f8a4f209..a69682b3 100644 --- a/test/flux_source_test.go +++ b/test/flux_source_test.go @@ -167,7 +167,6 @@ var _ = Describe("Flux source integration", func() { It("is marked as failed and to be retried", func() { waitForStackFailure(stack) - refetch(stack) reconcilingCondition := apimeta.FindStatusCondition(stack.Status.Conditions, pulumiv1.ReconcilingCondition) Expect(reconcilingCondition).ToNot(BeNil()) Expect(reconcilingCondition.Reason).To(Equal(pulumiv1.ReconcilingRetryReason)) @@ -258,7 +257,6 @@ var _ = Describe("Flux source integration", func() { }) It("records the revision from the source", func() { - refetch(stack) Expect(stack.Status.LastUpdate).NotTo(BeNil()) Expect(stack.Status.LastUpdate.LastSuccessfulCommit).To(Equal(artifactRevision)) }) @@ -280,7 +278,6 @@ var _ = Describe("Flux source integration", func() { It("marks the stack as failed and to be retried", func() { waitForStackFailure(stack) - refetch(stack) Expect(apimeta.IsStatusConditionTrue(stack.Status.Conditions, pulumiv1.ReconcilingCondition)).To(BeTrue()) Expect(apimeta.IsStatusConditionTrue(stack.Status.Conditions, pulumiv1.ReadyCondition)).To(BeFalse()) @@ -297,7 +294,6 @@ var _ = Describe("Flux source integration", func() { Expect(k8sClient.Status().Update(context.TODO(), source)).To(Succeed()) waitForStackSuccess(stack) - refetch(stack) Expect(apimeta.IsStatusConditionTrue(stack.Status.Conditions, pulumiv1.ReadyCondition)).To(BeTrue()) }) }) @@ -312,7 +308,6 @@ var _ = Describe("Flux source integration", func() { It("rejects the tarball and fails with a retry", func() { resetWaitForStack() waitForStackFailure(stack) - refetch(stack) Expect(apimeta.IsStatusConditionTrue(stack.Status.Conditions, pulumiv1.ReconcilingCondition)).To(BeTrue()) Expect(apimeta.IsStatusConditionTrue(stack.Status.Conditions, pulumiv1.ReadyCondition)).To(BeFalse()) }) @@ -327,7 +322,6 @@ var _ = Describe("Flux source integration", func() { It("marks the Stack as failed and to be retried", func() { waitForStackFailure(stack) - refetch(stack) Expect(apimeta.IsStatusConditionTrue(stack.Status.Conditions, pulumiv1.ReconcilingCondition)).To(BeTrue()) Expect(apimeta.IsStatusConditionTrue(stack.Status.Conditions, pulumiv1.ReadyCondition)).To(BeFalse()) }) diff --git a/test/suite_test.go b/test/suite_test.go index 21e3c462..6486a8ba 100644 --- a/test/suite_test.go +++ b/test/suite_test.go @@ -151,17 +151,18 @@ func resetWaitForStack() { waitForStackSince = time.Now() } +// internalWaitForStackState refetches the given stack, until its .lastUpdated.state field matches +// the one given. NB it fetches into the pointer given, so mutates the struct it's pointing at. func internalWaitForStackState(stack *pulumiv1.Stack, state shared.StackUpdateStateMessage) { EventuallyWithOffset(2 /* called by other helpers */, func() bool { k := client.ObjectKeyFromObject(stack) - var s pulumiv1.Stack - err := k8sClient.Get(context.TODO(), k, &s) + err := k8sClient.Get(context.TODO(), k, stack) if err != nil { return false } - return s.Status.LastUpdate != nil && - s.Status.LastUpdate.State == state && - s.Status.LastUpdate.LastResyncTime.Time.After(waitForStackSince) + return stack.Status.LastUpdate != nil && + stack.Status.LastUpdate.State == state && + stack.Status.LastUpdate.LastResyncTime.Time.After(waitForStackSince) }, "30s", "1s").Should(BeTrue(), fmt.Sprintf("stack %q reaches state %q", stack.Name, state)) }