diff --git a/go/test/endtoend/backup/vtbackup/backup_only_test.go b/go/test/endtoend/backup/vtbackup/backup_only_test.go index c7a09c70d13..3fa63e42cba 100644 --- a/go/test/endtoend/backup/vtbackup/backup_only_test.go +++ b/go/test/endtoend/backup/vtbackup/backup_only_test.go @@ -222,11 +222,8 @@ func verifyBackupCount(t *testing.T, shardKsName string, expected int) []string } func listBackups(shardKsName string) ([]string, error) { - backups, err := localCluster.VtctlProcess.ExecuteCommandWithOutput( - "--backup_storage_implementation", "file", - "--file_backup_storage_root", - path.Join(os.Getenv("VTDATAROOT"), "tmp", "backupstorage"), - "ListBackups", shardKsName, + backups, err := localCluster.VtctldClientProcess.ExecuteCommandWithOutput( + "GetBackups", shardKsName, ) if err != nil { return nil, err @@ -246,10 +243,7 @@ func removeBackups(t *testing.T) { backups, err := listBackups(shardKsName) require.NoError(t, err) for _, backup := range backups { - _, err := localCluster.VtctlProcess.ExecuteCommandWithOutput( - "--backup_storage_implementation", "file", - "--file_backup_storage_root", - path.Join(os.Getenv("VTDATAROOT"), "tmp", "backupstorage"), + _, err := localCluster.VtctldClientProcess.ExecuteCommandWithOutput( "RemoveBackup", shardKsName, backup, ) require.NoError(t, err) diff --git a/go/test/endtoend/backup/vtbackup/main_test.go b/go/test/endtoend/backup/vtbackup/main_test.go index 6e1840b2979..54003416776 100644 --- a/go/test/endtoend/backup/vtbackup/main_test.go +++ b/go/test/endtoend/backup/vtbackup/main_test.go @@ -76,7 +76,7 @@ func TestMain(m *testing.M) { }, } shard := &localCluster.Keyspaces[0].Shards[0] - vtctldClientProcess := cluster.VtctldClientProcessInstance("localhost", localCluster.VtctldProcess.GrpcPort, localCluster.TmpDirectory) + vtctldClientProcess := cluster.VtctldClientProcessInstance(localCluster.VtctldProcess.GrpcPort, localCluster.TopoPort, "localhost", localCluster.TmpDirectory) _, err = vtctldClientProcess.ExecuteCommandWithOutput("CreateKeyspace", keyspaceName, "--durability-policy=semi_sync") if err != nil { return 1, err diff --git a/go/test/endtoend/cluster/cluster_process.go b/go/test/endtoend/cluster/cluster_process.go index 8cd04ab86da..dc816c15197 100644 --- a/go/test/endtoend/cluster/cluster_process.go +++ b/go/test/endtoend/cluster/cluster_process.go @@ -257,6 +257,15 @@ func (cluster *LocalProcessCluster) StartTopo() (err error) { } cluster.VtctldClientProcess = *cluster.NewVtctldClientProcessInstance("localhost", cluster.VtctldProcess.GrpcPort, cluster.TmpDirectory) + if !cluster.ReusingVTDATAROOT { + if err = cluster.VtctldClientProcess.AddCellInfo(cluster.Cell); err != nil { + log.Error(err) + time.Sleep(5 * time.Minute) + return + } + cluster.VtctldClientProcess.LogDir = cluster.TmpDirectory + } + return } @@ -1294,7 +1303,7 @@ func (cluster *LocalProcessCluster) NewVTOrcProcess(config VTOrcConfiguration) * // VtctldClientProcessInstance returns a VtctldProcess handle for vtctldclient process // configured with the given Config. func (cluster *LocalProcessCluster) NewVtctldClientProcessInstance(hostname string, grpcPort int, tmpDirectory string) *VtctldClientProcess { - version, err := GetMajorVersion("vtctld") // `vtctldclient` does not have a --version flag, so we assume both vtctl/vtctldclient have the same version + version, err := GetMajorVersion("vtctldclient") if err != nil { log.Warningf("failed to get major vtctldclient version; interop with CLI changes for VEP-4 may not work: %s", err) } diff --git a/go/test/endtoend/cluster/vtctldclient_process.go b/go/test/endtoend/cluster/vtctldclient_process.go index a87f9636adf..4d098114bb4 100644 --- a/go/test/endtoend/cluster/vtctldclient_process.go +++ b/go/test/endtoend/cluster/vtctldclient_process.go @@ -19,6 +19,7 @@ package cluster import ( "fmt" "os/exec" + "slices" "strings" "time" @@ -80,7 +81,10 @@ func (vtctldclient *VtctldClientProcess) ExecuteCommandWithOutput(args ...string var err error retries := 10 retryDelay := 1 * time.Second - pArgs := []string{"--server", vtctldclient.Server} + var pArgs []string + if !slices.Contains(args, "--server") { + args = append(args, "--server", vtctldclient.Server) + } if *isCoverage { pArgs = append(pArgs, "--test.coverprofile="+getCoveragePath("vtctldclient-"+args[0]+".out"), "--test.v") } @@ -108,9 +112,12 @@ func (vtctldclient *VtctldClientProcess) ExecuteCommandWithOutput(args ...string func (vtctldclient *VtctldClientProcess) AddCellInfo(Cell string) error { args := []string{ "--server", "internal", - "AddCellInfo", "--", + "--topo-implementation", vtctldclient.TopoImplementation, + "--topo-global-server-address", vtctldclient.TopoGlobalAddress, + "--topo-global-root", vtctldclient.TopoGlobalRoot, + "AddCellInfo", "--root", vtctldclient.TopoRootPath + Cell, - "--server_address", vtctldclient.TopoServerAddress, + "--server-address", vtctldclient.TopoServerAddress, Cell, } _, err := vtctldclient.ExecuteCommandWithOutput(args...) diff --git a/go/test/endtoend/vreplication/cluster_test.go b/go/test/endtoend/vreplication/cluster_test.go index c52db9bdc38..b242fbd2e9a 100644 --- a/go/test/endtoend/vreplication/cluster_test.go +++ b/go/test/endtoend/vreplication/cluster_test.go @@ -398,6 +398,12 @@ func (vc *VitessCluster) setupVtctld() { func (vc *VitessCluster) setupVtctldClient() { vc.VtctldClient = cluster.VtctldClientProcessInstance(vc.Vtctld.GrpcPort, mainClusterConfig.topoPort, vc.ClusterConfig.hostname, vc.ClusterConfig.tmpDir) require.NotNil(vc.t, vc.VtctldClient) + for _, cellName := range vc.CellNames { + vc.VtctldClient.AddCellInfo(cellName) + cell, err := vc.AddCell(vc.t, cellName) + require.NoError(vc.t, err) + require.NotNil(vc.t, cell) + } } // CleanupDataroot deletes the vtdataroot directory. Since we run multiple tests sequentially in a single CI test shard,