mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-27 00:19:36 -05:00
operators: fix flaky env test
This commit is contained in:
parent
3c05150721
commit
7f8cfb8f03
@ -43,6 +43,22 @@ var _ = Describe("PendingNode controller", func() {
|
|||||||
interval = time.Millisecond * 250
|
interval = time.Millisecond * 250
|
||||||
)
|
)
|
||||||
|
|
||||||
|
beGone := func() OmegaMatcher {
|
||||||
|
return MatchError(&errors.StatusError{
|
||||||
|
ErrStatus: metav1.Status{
|
||||||
|
Status: "Failure",
|
||||||
|
Message: `pendingnodes.update.edgeless.systems "pending-node" not found`,
|
||||||
|
Reason: "NotFound",
|
||||||
|
Details: &metav1.StatusDetails{
|
||||||
|
Name: pendingNodeName,
|
||||||
|
Group: "update.edgeless.systems",
|
||||||
|
Kind: "pendingnodes",
|
||||||
|
},
|
||||||
|
Code: http.StatusNotFound,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
pendingNodeLookupKey := types.NamespacedName{Name: pendingNodeName}
|
pendingNodeLookupKey := types.NamespacedName{Name: pendingNodeName}
|
||||||
|
|
||||||
Context("When creating pending node with goal join", func() {
|
Context("When creating pending node with goal join", func() {
|
||||||
@ -107,27 +123,17 @@ var _ = Describe("PendingNode controller", func() {
|
|||||||
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
|
||||||
Eventually(func() error {
|
Eventually(func() error {
|
||||||
Expect(k8sClient.Get(ctx, pendingNodeLookupKey, pendingNode)).Should(Succeed())
|
if err := k8sClient.Get(ctx, pendingNodeLookupKey, pendingNode); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
pendingNode.Spec.Deadline = &metav1.Time{Time: fakes.clock.Now().Add(time.Second)}
|
pendingNode.Spec.Deadline = &metav1.Time{Time: fakes.clock.Now().Add(time.Second)}
|
||||||
return k8sClient.Update(ctx, pendingNode)
|
return k8sClient.Update(ctx, pendingNode)
|
||||||
}, timeout, interval).Should(Succeed())
|
}, timeout, interval).Should(Or(Succeed(), beGone()))
|
||||||
|
|
||||||
By("checking if the pending node resource is deleted")
|
By("checking if the pending node resource is deleted")
|
||||||
Eventually(func() error {
|
Eventually(func() error {
|
||||||
return k8sClient.Get(ctx, pendingNodeLookupKey, createdPendingNode)
|
return k8sClient.Get(ctx, pendingNodeLookupKey, createdPendingNode)
|
||||||
}, timeout, interval).Should(MatchError(&errors.StatusError{
|
}, timeout, interval).Should(beGone())
|
||||||
ErrStatus: metav1.Status{
|
|
||||||
Status: "Failure",
|
|
||||||
Message: `pendingnodes.update.edgeless.systems "pending-node" not found`,
|
|
||||||
Reason: "NotFound",
|
|
||||||
Details: &metav1.StatusDetails{
|
|
||||||
Name: pendingNodeName,
|
|
||||||
Group: "update.edgeless.systems",
|
|
||||||
Kind: "pendingnodes",
|
|
||||||
},
|
|
||||||
Code: http.StatusNotFound,
|
|
||||||
},
|
|
||||||
}))
|
|
||||||
})
|
})
|
||||||
|
|
||||||
It("Should should detect successful node join", func() {
|
It("Should should detect successful node join", func() {
|
||||||
|
Loading…
Reference in New Issue
Block a user