Skip to content

Commit e103d1d

Browse files
[release-21.0] CI: Fix VDiff2 flaky e2e test (vitessio#18494) (vitessio#18525)
1 parent a7e6b38 commit e103d1d

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
@@ -534,6 +534,22 @@ func testStop(t *testing.T, ksWorkflow, cells string) {
534534
t.Run("Stop", func(t *testing.T) {
535535
// Create a new VDiff and immediately stop it.
536536
uuid, _ := performVDiff2Action(t, false, ksWorkflow, cells, "create", "", false)
537+
538+
// Ensure the state to be either completed or started
539+
isStartedOrCompleted := false
540+
maxRetries := 5
541+
for i := 1; i <= maxRetries; i++ {
542+
_, output := performVDiff2Action(t, false, ksWorkflow, cells, "show", uuid, false)
543+
jsonOutput := getVDiffInfo(output)
544+
isStartedOrCompleted = jsonOutput.State == "started" || jsonOutput.State == "completed"
545+
if isStartedOrCompleted || i == maxRetries {
546+
break
547+
}
548+
t.Logf("VDiff state expected to be started or completed, got: %s, retrying (attempt %d of %d)", jsonOutput.State, i, maxRetries)
549+
time.Sleep(vdiffRetryInterval)
550+
}
551+
require.True(t, isStartedOrCompleted, "VDiff state should either be started or completed")
552+
537553
_, _ = performVDiff2Action(t, false, ksWorkflow, cells, "stop", uuid, false)
538554
// Confirm the VDiff is in the expected state.
539555
_, output := performVDiff2Action(t, false, ksWorkflow, cells, "show", uuid, false)

0 commit comments

Comments
 (0)