Skip to content

Commit

Permalink
test: fix replica mode e2e (cloudnative-pg#4948)
Browse files Browse the repository at this point in the history
Strenghten the check and remove a hardcoded sleep.

Closes cloudnative-pg#4902

Signed-off-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
  • Loading branch information
fcanovai authored Jun 25, 2024
1 parent 433f723 commit 19c4d5a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/e2e/replica_mode_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,19 @@ var _ = Describe("Replica Mode", Label(tests.LabelReplication), func() {
By("setting replica mode on the src cluster", func() {
cluster, err := env.GetCluster(namespace, clusterOneName)
Expect(err).ToNot(HaveOccurred())
updateTime := time.Now().Truncate(time.Second)
cluster.Spec.ReplicaCluster.Enabled = ptr.To(true)
err = env.Client.Update(ctx, cluster)
Expect(err).ToNot(HaveOccurred())
AssertClusterIsReady(namespace, clusterOneName, testTimeouts[testUtils.ClusterIsReady], env)
time.Sleep(time.Second * 10)
Eventually(func(g Gomega) {
cluster, err := env.GetCluster(namespace, clusterOneName)
g.Expect(err).ToNot(HaveOccurred())
condition := getReplicaClusterSwitchCondition(cluster.Status.Conditions)
g.Expect(condition).ToNot(BeNil())
g.Expect(condition.Status).To(Equal(metav1.ConditionTrue))
}).Should(Succeed())
g.Expect(condition.LastTransitionTime.Time).To(BeTemporally(">=", updateTime))
}).WithTimeout(30 * time.Second).Should(Succeed())
AssertClusterIsReady(namespace, clusterOneName, testTimeouts[testUtils.ClusterIsReady], env)
})

By("checking that src cluster is now a replica cluster", func() {
Expand Down

0 comments on commit 19c4d5a

Please sign in to comment.