Skip to content

Commit

Permalink
Flaky test TestOnlineDDLVDiff: add additional check for vreplication …
Browse files Browse the repository at this point in the history
…workflow to exist (#15695)

Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Co-authored-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
  • Loading branch information
rohit-nayak-ps and shlomi-noach authored Apr 11, 2024
1 parent 0912690 commit f118ba2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions go/test/endtoend/vreplication/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,13 @@ func assertQueryDoesNotExecutesOnTablet(t *testing.T, conn *mysql.Conn, tablet *
assert.Equalf(t, count0, count1, "query %q executed in target;\ntried to match %q\nbefore:\n%s\n\nafter:\n%s\n\n", query, matchQuery, body0, body1)
}

func waitForWorkflowToBeCreated(t *testing.T, vc *VitessCluster, ksWorkflow string) {
require.NoError(t, waitForCondition("workflow to be created", func() bool {
_, err := vc.VtctlClient.ExecuteCommandWithOutput("Workflow", ksWorkflow, "show")
return err == nil
}, defaultTimeout))
}

// waitForWorkflowState waits for all of the given workflow's
// streams to reach the provided state. You can pass optional
// key value pairs of the form "key==value" to also wait for
Expand Down
4 changes: 3 additions & 1 deletion go/test/endtoend/vreplication/vdiff_online_ddl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ func execOnlineDDL(t *testing.T, strategy, keyspace, query string) string {
return false
}, defaultTimeout)
require.NoError(t, err)

// The online ddl migration is set to SchemaMigration_RUNNING before it creates the
// _vt.vreplication records. Hence wait for the vreplication workflow to be created as well.
waitForWorkflowToBeCreated(t, vc, fmt.Sprintf("%s.%s", keyspace, uuid))
}
return uuid
}
Expand Down

0 comments on commit f118ba2

Please sign in to comment.