mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
operator: make test more resilient (#959)
This commit is contained in:
parent
5cb10aef45
commit
0d0851e410
@ -148,9 +148,13 @@ var _ = Describe("AutoscalingStrategy controller", func() {
|
|||||||
}, timeout, interval).Should(Equal(int32(1)))
|
}, timeout, interval).Should(Equal(int32(1)))
|
||||||
|
|
||||||
By("disabling the autoscaler in the strategy")
|
By("disabling the autoscaler in the strategy")
|
||||||
Expect(k8sClient.Get(ctx, strategyLookupKey, strategy)).Should(Succeed())
|
Eventually(func() error {
|
||||||
strategy.Spec.Enabled = false
|
if err := k8sClient.Get(ctx, strategyLookupKey, strategy); err != nil {
|
||||||
Expect(k8sClient.Update(ctx, strategy)).Should(Succeed())
|
return err
|
||||||
|
}
|
||||||
|
strategy.Spec.Enabled = false
|
||||||
|
return k8sClient.Update(ctx, strategy)
|
||||||
|
}, timeout, interval).Should(Succeed())
|
||||||
|
|
||||||
By("checking the autoscaling deployment eventually has zero replicas")
|
By("checking the autoscaling deployment eventually has zero replicas")
|
||||||
Eventually(checkDeploymentReplicas, timeout, interval).Should(Equal(int32(0)))
|
Eventually(checkDeploymentReplicas, timeout, interval).Should(Equal(int32(0)))
|
||||||
|
@ -169,8 +169,13 @@ var _ = Describe("JoiningNode controller", func() {
|
|||||||
Expect(createdJoiningNode.Spec.ComponentsReference).Should(Equal(ComponentsReference3))
|
Expect(createdJoiningNode.Spec.ComponentsReference).Should(Equal(ComponentsReference3))
|
||||||
|
|
||||||
By("setting the deadline to the past")
|
By("setting the deadline to the past")
|
||||||
createdJoiningNode.Spec.Deadline = &metav1.Time{Time: fakes.clock.Now().Add(-time.Second)}
|
Eventually(func() error {
|
||||||
Expect(k8sClient.Update(ctx, createdJoiningNode)).Should(Succeed())
|
if err := k8sClient.Get(ctx, types.NamespacedName{Name: joiningNode.Name}, createdJoiningNode); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
createdJoiningNode.Spec.Deadline = &metav1.Time{Time: fakes.clock.Now().Add(-time.Second)}
|
||||||
|
return k8sClient.Update(ctx, createdJoiningNode)
|
||||||
|
}, timeout, interval).Should(Succeed())
|
||||||
|
|
||||||
By("deleting the joining node resource")
|
By("deleting the joining node resource")
|
||||||
Eventually(func() error {
|
Eventually(func() error {
|
||||||
|
@ -276,9 +276,19 @@ var _ = Describe("NodeVersion controller", func() {
|
|||||||
}, timeout, interval).Should(HaveKeyWithValue(heirAnnotation, secondNodeName))
|
}, timeout, interval).Should(HaveKeyWithValue(heirAnnotation, secondNodeName))
|
||||||
Expect(k8sClient.Get(ctx, secondNodeLookupKey, secondNode)).Should(Succeed())
|
Expect(k8sClient.Get(ctx, secondNodeLookupKey, secondNode)).Should(Succeed())
|
||||||
Expect(secondNode.Annotations).Should(HaveKeyWithValue(donorAnnotation, firstNodeName))
|
Expect(secondNode.Annotations).Should(HaveKeyWithValue(donorAnnotation, firstNodeName))
|
||||||
Expect(k8sClient.Get(ctx, nodeVersionLookupKey, nodeVersion)).Should(Succeed())
|
|
||||||
Expect(nodeVersion.Status.Donors).Should(HaveLen(1))
|
Eventually(func() error {
|
||||||
Expect(nodeVersion.Status.Heirs).Should(HaveLen(1))
|
if err := k8sClient.Get(ctx, nodeVersionLookupKey, nodeVersion); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if len(nodeVersion.Status.Donors) != 1 {
|
||||||
|
return fmt.Errorf("node version %s has %d donors, expected 1", nodeVersion.Name, len(nodeVersion.Status.Donors))
|
||||||
|
}
|
||||||
|
if len(nodeVersion.Status.Heirs) != 1 {
|
||||||
|
return fmt.Errorf("node version %s has %d heirs, expected 1", nodeVersion.Name, len(nodeVersion.Status.Heirs))
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}, timeout, interval).Should(Succeed())
|
||||||
Expect(k8sClient.Get(ctx, joiningPendingNodeLookupKey, pendingNode)).Should(Not(Succeed()))
|
Expect(k8sClient.Get(ctx, joiningPendingNodeLookupKey, pendingNode)).Should(Not(Succeed()))
|
||||||
|
|
||||||
By("checking that node labels are copied to the heir")
|
By("checking that node labels are copied to the heir")
|
||||||
|
@ -77,10 +77,13 @@ var _ = Describe("PendingNode controller", func() {
|
|||||||
}, timeout, interval).Should(Equal(updatev1alpha1.NodeStateCreating))
|
}, timeout, interval).Should(Equal(updatev1alpha1.NodeStateCreating))
|
||||||
|
|
||||||
By("updating the deadline to be in the past")
|
By("updating the deadline to be in the past")
|
||||||
deadline := fakes.clock.Now().Add(-time.Second)
|
Eventually(func() error {
|
||||||
Expect(k8sClient.Get(ctx, pendingNodeLookupKey, pendingNode)).Should(Succeed())
|
if err := k8sClient.Get(ctx, pendingNodeLookupKey, pendingNode); err != nil {
|
||||||
pendingNode.Spec.Deadline = &metav1.Time{Time: deadline}
|
return err
|
||||||
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 the pending node updates its goal")
|
By("checking the pending node updates its goal")
|
||||||
Eventually(func() updatev1alpha1.PendingNodeGoal {
|
Eventually(func() updatev1alpha1.PendingNodeGoal {
|
||||||
|
@ -90,9 +90,13 @@ var _ = Describe("ScalingGroup controller", func() {
|
|||||||
}, timeout, interval).Should(Equal("image-1"))
|
}, timeout, interval).Should(Equal("image-1"))
|
||||||
|
|
||||||
By("updating the node image")
|
By("updating the node image")
|
||||||
Expect(k8sClient.Get(ctx, nodeVersionLookupKey, nodeVersion)).Should(Succeed())
|
Eventually(func() error {
|
||||||
nodeVersion.Spec.ImageReference = "image-2"
|
if err := k8sClient.Get(ctx, nodeVersionLookupKey, nodeVersion); err != nil {
|
||||||
Expect(k8sClient.Update(ctx, nodeVersion)).Should(Succeed())
|
return err
|
||||||
|
}
|
||||||
|
nodeVersion.Spec.ImageReference = "image-2"
|
||||||
|
return k8sClient.Update(ctx, nodeVersion)
|
||||||
|
}, timeout, interval).Should(Succeed())
|
||||||
|
|
||||||
By("checking the scaling group eventually uses the latest image")
|
By("checking the scaling group eventually uses the latest image")
|
||||||
Eventually(func() string {
|
Eventually(func() string {
|
||||||
|
Loading…
Reference in New Issue
Block a user