From f118ba28f74904bfbe5f3f87cea3b5c8602f1ca7 Mon Sep 17 00:00:00 2001 From: Rohit Nayak <57520317+rohit-nayak-ps@users.noreply.github.com> Date: Thu, 11 Apr 2024 13:16:05 +0200 Subject: [PATCH] Flaky test TestOnlineDDLVDiff: add additional check for vreplication workflow to exist (#15695) Signed-off-by: Rohit Nayak Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Co-authored-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- go/test/endtoend/vreplication/helper_test.go | 7 +++++++ go/test/endtoend/vreplication/vdiff_online_ddl_test.go | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) 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 }