Skip to content

Commit

Permalink
Increase timeout when waiting for reconciler
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Mazzotti <[email protected]>
  • Loading branch information
anmazzotti committed Dec 12, 2024
1 parent a45c388 commit 18b83b6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
18 changes: 9 additions & 9 deletions internal/controllers/capiprovider_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ var _ = Describe("Reconcile CAPIProvider", func() {

dockerProvider := objectFromKey(client.ObjectKeyFromObject(provider), &operatorv1.InfrastructureProvider{})
dockerSecret := objectFromKey(client.ObjectKeyFromObject(provider), &corev1.Secret{})
Eventually(Object(dockerProvider)).ShouldNot(BeNil())
Eventually(Object(dockerSecret)).Should(HaveField("Data", Equal(map[string][]byte{
Eventually(Object(dockerProvider)).WithTimeout(5 * time.Second).ShouldNot(BeNil())
Eventually(Object(dockerSecret)).WithTimeout(5 * time.Second).Should(HaveField("Data", Equal(map[string][]byte{
"CLUSTER_TOPOLOGY": []byte("true"),
"EXP_CLUSTER_RESOURCE_SET": []byte("true"),
"EXP_MACHINE_POOL": []byte("true"),
Expand All @@ -87,7 +87,7 @@ var _ = Describe("Reconcile CAPIProvider", func() {
}}
Expect(cl.Create(ctx, provider)).ToNot(HaveOccurred())

Eventually(Object(provider)).Should(
Eventually(Object(provider)).WithTimeout(5 * time.Second).Should(
HaveField("Status.Name", Equal(provider.Name)))
})

Expand All @@ -101,7 +101,7 @@ var _ = Describe("Reconcile CAPIProvider", func() {
}}
Expect(cl.Create(ctx, provider)).ToNot(HaveOccurred())

Eventually(Object(provider)).Should(
Eventually(Object(provider)).WithTimeout(5 * time.Second).Should(
HaveField("Status.Name", Equal(provider.Spec.Name)))
})

Expand All @@ -116,8 +116,8 @@ var _ = Describe("Reconcile CAPIProvider", func() {

dockerProvider := objectFromKey(client.ObjectKeyFromObject(provider), &operatorv1.InfrastructureProvider{})
dockerSecret := objectFromKey(client.ObjectKeyFromObject(provider), &corev1.Secret{})
Eventually(Object(dockerProvider)).ShouldNot(BeNil())
Eventually(Object(dockerSecret)).ShouldNot(BeNil())
Eventually(Object(dockerProvider)).WithTimeout(5 * time.Second).ShouldNot(BeNil())
Eventually(Object(dockerSecret)).WithTimeout(5 * time.Second).ShouldNot(BeNil())

Eventually(Update(provider, func() {
provider.Spec.Version = "v1.2.3"
Expand All @@ -126,8 +126,8 @@ var _ = Describe("Reconcile CAPIProvider", func() {
}
})).Should(Succeed())

Eventually(Object(dockerProvider)).Should(HaveField("Spec.Version", Equal("v1.2.3")))
Eventually(Object(dockerSecret)).Should(HaveField("Data", Equal(map[string][]byte{
Eventually(Object(dockerProvider)).WithTimeout(5 * time.Second).Should(HaveField("Spec.Version", Equal("v1.2.3")))
Eventually(Object(dockerSecret)).WithTimeout(5 * time.Second).Should(HaveField("Data", Equal(map[string][]byte{
"other": []byte("var"),
"CLUSTER_TOPOLOGY": []byte("true"),
"EXP_CLUSTER_RESOURCE_SET": []byte("true"),
Expand Down Expand Up @@ -177,7 +177,7 @@ var _ = Describe("Reconcile CAPIProvider", func() {
}
})).Should(Succeed())

Eventually(Object(doSecret)).Should(HaveField("Data", Equal(map[string][]byte{
Eventually(Object(doSecret)).WithTimeout(5 * time.Second).Should(HaveField("Data", Equal(map[string][]byte{
"EXP_MACHINE_POOL": []byte("true"),
"CLUSTER_TOPOLOGY": []byte("false"),
"EXP_CLUSTER_RESOURCE_SET": []byte("false"),
Expand Down
4 changes: 4 additions & 0 deletions test/framework/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ limitations under the License.

package framework

import "time"

const (
// DefaultNamespace is the name of the default Kubernetes namespace.
DefaultNamespace = "default"
Expand All @@ -27,4 +29,6 @@ const (
MagicDNS = "sslip.io"
// DefaulRancherTurtlesNamespace is the name of the default namespace for Rancher Turtles.
DefaultRancherTurtlesNamespace = "rancher-turtles-system"
// Default reconciliation timeout.
DefaultReconciliationTimeout = 5 * time.Second
)
4 changes: 2 additions & 2 deletions test/framework/turtles.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func WaitForCAPIProviderRollout(ctx context.Context, input WaitForCAPIProviderRo
g.Expect(input.Getter.Get(ctx, key, capiProvider)).To(Succeed())
g.Expect(capiProvider.Status.InstalledVersion).ToNot(BeNil())
g.Expect(*capiProvider.Status.InstalledVersion).To(Equal(input.Version))
}, intervals...).Should(Succeed(),
}, intervals...).WithTimeout(DefaultReconciliationTimeout).Should(Succeed(),
"Failed to get CAPIProvider %s with version %s. Last observed: %s",
key.String(), input.Version, klog.KObj(capiProvider))
}
Expand All @@ -66,7 +66,7 @@ func WaitForCAPIProviderRollout(ctx context.Context, input WaitForCAPIProviderRo
}
}
g.Expect(found).To(BeTrue())
}, intervals...).Should(Succeed(),
}, intervals...).WithTimeout(DefaultReconciliationTimeout).Should(Succeed(),
"Failed to get Deployment %s with image %s. Last observed: %s",
client.ObjectKeyFromObject(input.Deployment).String(), input.Image, klog.KObj(input.Deployment))
}
Expand Down

0 comments on commit 18b83b6

Please sign in to comment.