Skip to content

Commit 7dd3c6b

Browse files
authored
CI: Fix VDiff2 flaky e2e test (vitessio#18494)
Signed-off-by: Noble Mittal <[email protected]>
1 parent ee051c6 commit 7dd3c6b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

go/test/endtoend/vreplication/vdiff2_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,22 @@ func testStop(t *testing.T, ksWorkflow, cells string) {
541541
t.Run("Stop", func(t *testing.T) {
542542
// Create a new VDiff and immediately stop it.
543543
uuid, _ := performVDiff2Action(t, ksWorkflow, cells, "create", "", false)
544+
545+
// Ensure the state to be either completed or started
546+
isStartedOrCompleted := false
547+
maxRetries := 5
548+
for i := 1; i <= maxRetries; i++ {
549+
_, output := performVDiff2Action(t, ksWorkflow, cells, "show", uuid, false)
550+
jsonOutput := getVDiffInfo(output)
551+
isStartedOrCompleted = jsonOutput.State == "started" || jsonOutput.State == "completed"
552+
if isStartedOrCompleted || i == maxRetries {
553+
break
554+
}
555+
t.Logf("VDiff state expected to be started or completed, got: %s, retrying (attempt %d of %d)", jsonOutput.State, i, maxRetries)
556+
time.Sleep(vdiffRetryInterval)
557+
}
558+
require.True(t, isStartedOrCompleted, "VDiff state should either be started or completed")
559+
544560
_, _ = performVDiff2Action(t, ksWorkflow, cells, "stop", uuid, false)
545561
// Confirm the VDiff is in the expected state.
546562
_, output := performVDiff2Action(t, ksWorkflow, cells, "show", uuid, false)

0 commit comments

Comments
 (0)