Skip to content

Commit

Permalink
Fix migrate tests
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <[email protected]>
  • Loading branch information
mattlord committed Jan 2, 2025
1 parent 7b213c3 commit 0d136d4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 23 deletions.
16 changes: 0 additions & 16 deletions go/test/endtoend/cluster/cluster_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion go/test/endtoend/cluster/vtctldclient_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion go/test/endtoend/vreplication/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 4 additions & 5 deletions go/test/endtoend/vreplication/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ 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
// hence the VTDATAROOT env variable gets overwritten.
// 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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0d136d4

Please sign in to comment.