diff --git a/go/test/endtoend/vreplication/vdiff2_test.go b/go/test/endtoend/vreplication/vdiff2_test.go index 2011f8613c8..99e5afa9b55 100644 --- a/go/test/endtoend/vreplication/vdiff2_test.go +++ b/go/test/endtoend/vreplication/vdiff2_test.go @@ -220,13 +220,13 @@ func testWorkflow(t *testing.T, vc *VitessCluster, tc *testCase, cells []*Cell) func testCLIErrors(t *testing.T, ksWorkflow, cells string) { t.Run("Client error handling", func(t *testing.T) { _, output := performVDiff2Action(t, ksWorkflow, cells, "badcmd", "", true) - require.Contains(t, output, "usage:") + require.Contains(t, output, "Usage:") _, output = performVDiff2Action(t, ksWorkflow, cells, "create", "invalid_uuid", true) - require.Contains(t, output, "please provide a valid UUID") + require.Contains(t, output, "invalid UUID provided") _, output = performVDiff2Action(t, ksWorkflow, cells, "resume", "invalid_uuid", true) - require.Contains(t, output, "can only resume a specific vdiff, please provide a valid UUID") + require.Contains(t, output, "invalid UUID provided") _, output = performVDiff2Action(t, ksWorkflow, cells, "delete", "invalid_uuid", true) - require.Contains(t, output, "can only delete a specific vdiff, please provide a valid UUID") + require.Contains(t, output, "invalid UUID provided") uuid, _ := performVDiff2Action(t, ksWorkflow, cells, "show", "last", false) _, output = performVDiff2Action(t, ksWorkflow, cells, "create", uuid, true) require.Contains(t, output, "already exists") @@ -312,7 +312,7 @@ func testResume(t *testing.T, tc *testCase, cells string) { // confirm that the VDiff was resumed, able to complete, and we compared the // expected number of rows in total (original run and resume) - uuid, _ = performVDiff2Action(t, ksWorkflow, cells, "resume", uuid, false) + _, _ = performVDiff2Action(t, ksWorkflow, cells, "resume", uuid, false) info := waitForVDiff2ToComplete(t, ksWorkflow, cells, uuid, ogTime) require.False(t, info.HasMismatch) require.Equal(t, expectedRows, info.RowsCompared) diff --git a/go/test/endtoend/vreplication/vdiff_helper_test.go b/go/test/endtoend/vreplication/vdiff_helper_test.go index 982ea04c957..ab4e251e49f 100644 --- a/go/test/endtoend/vreplication/vdiff_helper_test.go +++ b/go/test/endtoend/vreplication/vdiff_helper_test.go @@ -173,19 +173,27 @@ func doVdiff2(t *testing.T, keyspace, workflow, cells string, want *expectedVDif func performVDiff2Action(t *testing.T, ksWorkflow, cells, action, actionArg string, expectError bool, extraFlags ...string) (uuid string, output string) { var err error - args := []string{"VDiff", "--", "--tablet_types=primary", "--source_cell=" + cells, "--format=json"} + targetKeyspace, workflowName, ok := strings.Cut(ksWorkflow, ".") + require.True(t, ok, "invalid keyspace.workflow value: %s", ksWorkflow) + + args := []string{"VDiff", "--target-keyspace", targetKeyspace, "--workflow", workflowName, "--format=json", action} + if strings.ToLower(action) == string(vdiff2.CreateAction) { + args = append(args, "--tablet-types=primary", "--source-cells="+cells) + } if len(extraFlags) > 0 { args = append(args, extraFlags...) } - args = append(args, ksWorkflow, action, actionArg) - output, err = vc.VtctlClient.ExecuteCommandWithOutput(args...) + if actionArg != "" { + args = append(args, actionArg) + } + output, err = vc.VtctldClient.ExecuteCommandWithOutput(args...) log.Infof("vdiff2 output: %+v (err: %+v)", output, err) if !expectError { - require.Nil(t, err) - uuid = gjson.Get(output, "UUID").String() - if action != "delete" && !(action == "show" && actionArg == "all") { // a UUID is not required - require.NoError(t, err) - require.NotEmpty(t, uuid) + require.NoError(t, err) + ouuid := gjson.Get(output, "UUID").String() + if action == "create" || (action == "show" && actionArg != "all") { // A UUID is returned + require.NotEmpty(t, ouuid) + uuid = ouuid } } return uuid, output