mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-01-24 14:22:14 -05:00
operator: make test more resilient
This commit is contained in:
parent
5782e0c884
commit
ab508a52d6
@ -32,7 +32,6 @@ var _ = Describe("AutoscalingStrategy controller", func() {
|
|||||||
ScalingGroupNameControlPlane = "control-plane-group"
|
ScalingGroupNameControlPlane = "control-plane-group"
|
||||||
|
|
||||||
timeout = time.Second * 20
|
timeout = time.Second * 20
|
||||||
duration = time.Second * 2
|
|
||||||
interval = time.Millisecond * 250
|
interval = time.Millisecond * 250
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -146,14 +145,7 @@ var _ = Describe("AutoscalingStrategy controller", func() {
|
|||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
return createdStrategy.Status.Replicas, nil
|
return createdStrategy.Status.Replicas, nil
|
||||||
}, duration, interval).Should(Equal(int32(1)))
|
}, timeout, interval).Should(Equal(int32(1)))
|
||||||
Consistently(func() (int32, error) {
|
|
||||||
err := k8sClient.Get(ctx, strategyLookupKey, createdStrategy)
|
|
||||||
if err != nil {
|
|
||||||
return -1, err
|
|
||||||
}
|
|
||||||
return createdStrategy.Status.Replicas, nil
|
|
||||||
}, duration, 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())
|
Expect(k8sClient.Get(ctx, strategyLookupKey, strategy)).Should(Succeed())
|
||||||
|
@ -162,8 +162,14 @@ var _ = Describe("NodeVersion controller", func() {
|
|||||||
By("updating the node version")
|
By("updating the node version")
|
||||||
fakes.nodeStateGetter.setNodeState(updatev1alpha1.NodeStateReady)
|
fakes.nodeStateGetter.setNodeState(updatev1alpha1.NodeStateReady)
|
||||||
fakes.nodeReplacer.setCreatedNode(secondNodeName, secondNodeName, nil)
|
fakes.nodeReplacer.setCreatedNode(secondNodeName, secondNodeName, nil)
|
||||||
nodeVersion.Spec = newNodeVersionSpec
|
// Eventually the node version with the new NodeVersion spec.
|
||||||
Expect(k8sClient.Update(ctx, nodeVersion)).Should(Succeed())
|
Eventually(func() error {
|
||||||
|
if err := k8sClient.Get(ctx, nodeVersionLookupKey, nodeVersion); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
nodeVersion.Spec = newNodeVersionSpec
|
||||||
|
return k8sClient.Update(ctx, nodeVersion)
|
||||||
|
}, timeout, interval).Should(Succeed())
|
||||||
|
|
||||||
By("checking that there is an outdated node in the status")
|
By("checking that there is an outdated node in the status")
|
||||||
Eventually(func() int {
|
Eventually(func() int {
|
||||||
@ -185,11 +191,11 @@ var _ = Describe("NodeVersion controller", func() {
|
|||||||
pendingNode := &updatev1alpha1.PendingNode{}
|
pendingNode := &updatev1alpha1.PendingNode{}
|
||||||
Eventually(func() error {
|
Eventually(func() error {
|
||||||
return k8sClient.Get(ctx, joiningPendingNodeLookupKey, pendingNode)
|
return k8sClient.Get(ctx, joiningPendingNodeLookupKey, pendingNode)
|
||||||
}).Should(Succeed())
|
}, timeout, interval).Should(Succeed())
|
||||||
Eventually(func() updatev1alpha1.CSPNodeState {
|
Eventually(func() updatev1alpha1.CSPNodeState {
|
||||||
_ = k8sClient.Get(ctx, joiningPendingNodeLookupKey, pendingNode)
|
_ = k8sClient.Get(ctx, joiningPendingNodeLookupKey, pendingNode)
|
||||||
return pendingNode.Status.CSPNodeState
|
return pendingNode.Status.CSPNodeState
|
||||||
}).Should(Equal(updatev1alpha1.NodeStateReady))
|
}, timeout, interval).Should(Equal(updatev1alpha1.NodeStateReady))
|
||||||
Eventually(func() int {
|
Eventually(func() int {
|
||||||
if err := k8sClient.Get(ctx, nodeVersionLookupKey, nodeVersion); err != nil {
|
if err := k8sClient.Get(ctx, nodeVersionLookupKey, nodeVersion); err != nil {
|
||||||
return 0
|
return 0
|
||||||
|
@ -27,7 +27,6 @@ var _ = Describe("ScalingGroup controller", func() {
|
|||||||
scalingGroupName = "test-group"
|
scalingGroupName = "test-group"
|
||||||
|
|
||||||
timeout = time.Second * 20
|
timeout = time.Second * 20
|
||||||
duration = time.Second * 2
|
|
||||||
interval = time.Millisecond * 250
|
interval = time.Millisecond * 250
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -89,13 +88,6 @@ var _ = Describe("ScalingGroup controller", func() {
|
|||||||
}
|
}
|
||||||
return createdScalingGroup.Status.ImageReference
|
return createdScalingGroup.Status.ImageReference
|
||||||
}, timeout, interval).Should(Equal("image-1"))
|
}, timeout, interval).Should(Equal("image-1"))
|
||||||
Consistently(func() (string, error) {
|
|
||||||
err := k8sClient.Get(ctx, scalingGroupLookupKey, createdScalingGroup)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
return createdScalingGroup.Status.ImageReference, nil
|
|
||||||
}, duration, interval).Should(Equal("image-1"))
|
|
||||||
|
|
||||||
By("updating the node image")
|
By("updating the node image")
|
||||||
Expect(k8sClient.Get(ctx, nodeVersionLookupKey, nodeVersion)).Should(Succeed())
|
Expect(k8sClient.Get(ctx, nodeVersionLookupKey, nodeVersion)).Should(Succeed())
|
||||||
@ -109,13 +101,13 @@ var _ = Describe("ScalingGroup controller", func() {
|
|||||||
}, timeout, interval).Should(Equal("image-2"))
|
}, timeout, interval).Should(Equal("image-2"))
|
||||||
|
|
||||||
By("checking the scaling group status shows the latest image")
|
By("checking the scaling group status shows the latest image")
|
||||||
Consistently(func() (string, error) {
|
Eventually(func() (string, error) {
|
||||||
err := k8sClient.Get(ctx, scalingGroupLookupKey, createdScalingGroup)
|
err := k8sClient.Get(ctx, scalingGroupLookupKey, createdScalingGroup)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
return createdScalingGroup.Status.ImageReference, nil
|
return createdScalingGroup.Status.ImageReference, nil
|
||||||
}, duration, interval).Should(Equal("image-2"))
|
}, timeout, interval).Should(Equal("image-2"))
|
||||||
|
|
||||||
By("cleaning up all resources")
|
By("cleaning up all resources")
|
||||||
Expect(k8sClient.Delete(ctx, createdNodeVersion)).Should(Succeed())
|
Expect(k8sClient.Delete(ctx, createdNodeVersion)).Should(Succeed())
|
||||||
|
Loading…
Reference in New Issue
Block a user