From 0d136d4c99891c24e0aab988194117d6f8d860b9 Mon Sep 17 00:00:00 2001 From: Matt Lord Date: Thu, 2 Jan 2025 17:30:29 -0500 Subject: [PATCH] Fix migrate tests Signed-off-by: Matt Lord --- go/test/endtoend/cluster/cluster_util.go | 16 ---------------- go/test/endtoend/cluster/vtctldclient_process.go | 2 +- go/test/endtoend/vreplication/cluster_test.go | 2 +- go/test/endtoend/vreplication/migrate_test.go | 9 ++++----- 4 files changed, 6 insertions(+), 23 deletions(-) diff --git a/go/test/endtoend/cluster/cluster_util.go b/go/test/endtoend/cluster/cluster_util.go index d449b4c64f7..18f78dcb3d0 100644 --- a/go/test/endtoend/cluster/cluster_util.go +++ b/go/test/endtoend/cluster/cluster_util.go @@ -299,22 +299,6 @@ func NewConnParams(port int, password, socketPath, keyspace string) mysql.ConnPa } -func filterDoubleDashArgs(args []string, version int) (filtered []string) { - if version > 13 { - return args - } - - for _, arg := range args { - if arg == "--" { - continue - } - - filtered = append(filtered, arg) - } - - return filtered -} - // WriteDbCredentialToTmp writes JSON formatted db credentials to the // specified tmp directory. func WriteDbCredentialToTmp(tmpDir string) string { diff --git a/go/test/endtoend/cluster/vtctldclient_process.go b/go/test/endtoend/cluster/vtctldclient_process.go index 9b76145c45d..fd8f627f7e5 100644 --- a/go/test/endtoend/cluster/vtctldclient_process.go +++ b/go/test/endtoend/cluster/vtctldclient_process.go @@ -99,7 +99,7 @@ func (vtctldclient *VtctldClientProcess) ExecuteCommandWithOutput(args ...string for i := range retries { tmpProcess := exec.Command( vtctldclient.Binary, - filterDoubleDashArgs(pArgs, vtctldclient.VtctldClientMajorVersion)..., + pArgs..., ) msg := binlogplayer.LimitString(strings.Join(tmpProcess.Args, " "), 256) // limit log line length if !vtctldclient.Quiet { diff --git a/go/test/endtoend/vreplication/cluster_test.go b/go/test/endtoend/vreplication/cluster_test.go index 70c6a8a5b7f..a2f32fcebb8 100644 --- a/go/test/endtoend/vreplication/cluster_test.go +++ b/go/test/endtoend/vreplication/cluster_test.go @@ -396,7 +396,7 @@ func (vc *VitessCluster) setupVtctld() { } func (vc *VitessCluster) setupVtctldClient() { - vc.VtctldClient = cluster.VtctldClientProcessInstance(vc.Vtctld.GrpcPort, mainClusterConfig.topoPort, vc.ClusterConfig.hostname, vc.ClusterConfig.tmpDir) + vc.VtctldClient = cluster.VtctldClientProcessInstance(vc.ClusterConfig.vtctldGrpcPort, vc.ClusterConfig.topoPort, vc.ClusterConfig.hostname, vc.ClusterConfig.tmpDir) require.NotNil(vc.t, vc.VtctldClient) for _, cellName := range vc.CellNames { vc.VtctldClient.AddCellInfo(cellName) diff --git a/go/test/endtoend/vreplication/migrate_test.go b/go/test/endtoend/vreplication/migrate_test.go index 86b912738bc..d7d5339db2b 100644 --- a/go/test/endtoend/vreplication/migrate_test.go +++ b/go/test/endtoend/vreplication/migrate_test.go @@ -41,7 +41,7 @@ func insertInitialDataIntoExternalCluster(t *testing.T, conn *mysql.Conn) { }) } -// TestMigrate runs an e2e test for importing from an external cluster using the vtctldclient Mount and Migrate commands. +// TestMigrateUnsharded runs an e2e test for importing from an external cluster using the vtctldclient Mount and Migrate commands. // We have an anti-pattern in Vitess: vt executables look for an environment variable VTDATAROOT for certain cluster parameters // like the log directory when they are created. Until this test we just needed a single cluster for e2e tests. // However now we need to create an external Vitess cluster. For this we need a different VTDATAROOT and @@ -49,6 +49,7 @@ func insertInitialDataIntoExternalCluster(t *testing.T, conn *mysql.Conn) { // Each time we need to create vt processes in the "other" cluster we need to set the appropriate VTDATAROOT func TestMigrateUnsharded(t *testing.T) { vc = NewVitessCluster(t, nil) + defer vc.TearDown() oldDefaultReplicas := defaultReplicas oldDefaultRdonly := defaultRdonly @@ -59,8 +60,6 @@ func TestMigrateUnsharded(t *testing.T) { defaultRdonly = oldDefaultRdonly }() - defer vc.TearDown() - defaultCell := vc.Cells[vc.CellNames[0]] _, err := vc.AddKeyspace(t, []*Cell{defaultCell}, "product", "0", initialProductVSchema, initialProductSchema, defaultReplicas, defaultRdonly, 100, nil) @@ -189,10 +188,10 @@ func TestMigrateUnsharded(t *testing.T) { }) } -// TestVtctldMigrate adds a test for a sharded cluster to validate a fix for a bug where the target keyspace name +// TestMigrateSharded adds a test for a sharded cluster to validate a fix for a bug where the target keyspace name // doesn't match that of the source cluster. The test migrates from a cluster with keyspace customer to an "external" // cluster with keyspace rating. -func TestVtctldMigrateSharded(t *testing.T) { +func TestMigrateSharded(t *testing.T) { setSidecarDBName("_vt") currentWorkflowType = binlogdatapb.VReplicationWorkflowType_MoveTables oldDefaultReplicas := defaultReplicas