diff --git a/go/test/endtoend/vreplication/helper_test.go b/go/test/endtoend/vreplication/helper_test.go index 29d8f518638..b5310822d0c 100644 --- a/go/test/endtoend/vreplication/helper_test.go +++ b/go/test/endtoend/vreplication/helper_test.go @@ -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 diff --git a/go/test/endtoend/vreplication/vdiff_online_ddl_test.go b/go/test/endtoend/vreplication/vdiff_online_ddl_test.go index bad1b840069..92977111294 100644 --- a/go/test/endtoend/vreplication/vdiff_online_ddl_test.go +++ b/go/test/endtoend/vreplication/vdiff_online_ddl_test.go @@ -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 }