node operator: retry updating pendingNode deadline on conflict

Signed-off-by: Malte Poll <mp@edgeless.systems>
This commit is contained in:
Malte Poll 2022-08-30 09:49:35 +02:00 committed by Malte Poll
parent 5c87913250
commit 07c6c4e190

View File

@ -87,9 +87,11 @@ var _ = Describe("PendingNode controller", func() {
By("setting the CSP node state to terminated") By("setting the CSP node state to terminated")
fakes.nodeStateGetter.setNodeState(updatev1alpha1.NodeStateTerminated) fakes.nodeStateGetter.setNodeState(updatev1alpha1.NodeStateTerminated)
// trigger reconciliation before regular check interval to speed up test by changing the spec // trigger reconciliation before regular check interval to speed up test by changing the spec
Expect(k8sClient.Get(ctx, pendingNodeLookupKey, pendingNode)).Should(Succeed()) Eventually(func() error {
pendingNode.Spec.Deadline = &metav1.Time{Time: fakes.clock.Now().Add(time.Second)} Expect(k8sClient.Get(ctx, pendingNodeLookupKey, pendingNode)).Should(Succeed())
Expect(k8sClient.Update(ctx, pendingNode)).Should(Succeed()) pendingNode.Spec.Deadline = &metav1.Time{Time: fakes.clock.Now().Add(time.Second)}
return k8sClient.Update(ctx, pendingNode)
}, timeout, interval).Should(Succeed())
By("checking if the pending node resource is deleted") By("checking if the pending node resource is deleted")
Eventually(func() error { Eventually(func() error {