From 4ec0dc1b4647b69b61d503202265e090dcae967b Mon Sep 17 00:00:00 2001 From: Matt Lord Date: Thu, 2 Jan 2025 13:37:45 -0500 Subject: [PATCH] Fix vtctldclient creation Signed-off-by: Matt Lord --- go/test/endtoend/backup/vtctlbackup/backup_utils.go | 2 +- go/test/endtoend/docker/vttestserver_test.go | 4 ++-- go/test/endtoend/recovery/unshardedrecovery/recovery.go | 2 +- go/test/endtoend/reparent/emergencyreparent/ers_test.go | 6 +++--- go/test/endtoend/reparent/utils/utils.go | 6 ++++++ .../endtoend/tabletmanager/throttler_topo/throttler_test.go | 2 +- go/test/endtoend/vault/vault_test.go | 2 +- 7 files changed, 15 insertions(+), 9 deletions(-) diff --git a/go/test/endtoend/backup/vtctlbackup/backup_utils.go b/go/test/endtoend/backup/vtctlbackup/backup_utils.go index 86b2612a044..afa5023a047 100644 --- a/go/test/endtoend/backup/vtctlbackup/backup_utils.go +++ b/go/test/endtoend/backup/vtctlbackup/backup_utils.go @@ -254,7 +254,7 @@ func LaunchCluster(setupType int, streamMode string, stripes int, cDetails *Comp if err := localCluster.InitTablet(replica2, keyspaceName, shard.Name); err != nil { return 1, err } - vtctldClientProcess := cluster.VtctldClientProcessInstance("localhost", localCluster.VtctldProcess.GrpcPort, localCluster.TmpDirectory) + vtctldClientProcess := cluster.VtctldClientProcessInstance(localCluster.VtctldProcess.GrpcPort, localCluster.TopoPort, "localhost", localCluster.TmpDirectory) _, err = vtctldClientProcess.ExecuteCommandWithOutput("SetKeyspaceDurabilityPolicy", keyspaceName, "--durability-policy=semi_sync") if err != nil { return 1, err diff --git a/go/test/endtoend/docker/vttestserver_test.go b/go/test/endtoend/docker/vttestserver_test.go index e34be52accf..4cbe5cdf0fc 100644 --- a/go/test/endtoend/docker/vttestserver_test.go +++ b/go/test/endtoend/docker/vttestserver_test.go @@ -140,8 +140,8 @@ func TestVtctldCommands(t *testing.T) { err = vtest.waitUntilDockerHealthy(10) require.NoError(t, err) - vtctldClient := cluster.VtctldClientProcessInstance("localhost", vtest.basePort+1, os.TempDir()) - res, err := vtctldClient.ExecuteCommandWithOutput("GetKeyspaces") + vtctldClient := cluster.VtctldClientProcessInstance(vtest.basePort+1, 0, "localhost", os.TempDir()) + res, err := vtctldClient.ExecuteCommandWithOutput("--server", "internal", "GetKeyspaces") require.NoError(t, err) // We verify that the command succeeds, and the keyspace name is present in the output. require.Contains(t, res, "long_ks_name") diff --git a/go/test/endtoend/recovery/unshardedrecovery/recovery.go b/go/test/endtoend/recovery/unshardedrecovery/recovery.go index ae6b152271b..0d3c38a50f7 100644 --- a/go/test/endtoend/recovery/unshardedrecovery/recovery.go +++ b/go/test/endtoend/recovery/unshardedrecovery/recovery.go @@ -158,7 +158,7 @@ func TestMainImpl(m *testing.M) { } } - vtctldClientProcess := cluster.VtctldClientProcessInstance("localhost", localCluster.VtctldProcess.GrpcPort, localCluster.TmpDirectory) + vtctldClientProcess := cluster.VtctldClientProcessInstance(localCluster.VtctldProcess.GrpcPort, localCluster.TopoPort, "localhost", localCluster.TmpDirectory) _, err = vtctldClientProcess.ExecuteCommandWithOutput("SetKeyspaceDurabilityPolicy", keyspaceName, "--durability-policy=semi_sync") if err != nil { return 1, err diff --git a/go/test/endtoend/reparent/emergencyreparent/ers_test.go b/go/test/endtoend/reparent/emergencyreparent/ers_test.go index 0d2eb8935d2..8e219bf589e 100644 --- a/go/test/endtoend/reparent/emergencyreparent/ers_test.go +++ b/go/test/endtoend/reparent/emergencyreparent/ers_test.go @@ -47,8 +47,8 @@ func TestTrivialERS(t *testing.T) { } // We should do the same for vtctl binary for i := 1; i <= 4; i++ { - out, err := utils.ErsWithVtctl(clusterInstance) - log.Infof("ERS-vtctl loop %d. EmergencyReparentShard Output: %v", i, out) + out, err := utils.ErsWithVtctldClient(clusterInstance) + log.Infof("ERS-vtctldclient loop %d. EmergencyReparentShard Output: %v", i, out) require.NoError(t, err) time.Sleep(5 * time.Second) } @@ -395,7 +395,7 @@ func TestERSForInitialization(t *testing.T) { err = clusterInstance.SetupCluster(keyspace, []cluster.Shard{*shard}) require.NoError(t, err) if clusterInstance.VtctlMajorVersion >= 14 { - vtctldClientProcess := cluster.VtctldClientProcessInstance("localhost", clusterInstance.VtctldProcess.GrpcPort, clusterInstance.TmpDirectory) + vtctldClientProcess := cluster.VtctldClientProcessInstance(clusterInstance.VtctldProcess.GrpcPort, clusterInstance.TopoPort, "localhost", clusterInstance.TmpDirectory) out, err := vtctldClientProcess.ExecuteCommandWithOutput("SetKeyspaceDurabilityPolicy", keyspace.Name, "--durability-policy=semi_sync") require.NoError(t, err, out) } diff --git a/go/test/endtoend/reparent/utils/utils.go b/go/test/endtoend/reparent/utils/utils.go index 5120681a823..acf7f6fe7d7 100644 --- a/go/test/endtoend/reparent/utils/utils.go +++ b/go/test/endtoend/reparent/utils/utils.go @@ -406,6 +406,12 @@ func ErsIgnoreTablet(clusterInstance *cluster.LocalProcessCluster, tab *cluster. return clusterInstance.VtctldClientProcess.ExecuteCommandWithOutput(args...) } +// ErsWithVtctldClient runs ERS via vtctldclient binary +func ErsWithVtctldClient(clusterInstance *cluster.LocalProcessCluster) (string, error) { + args := []string{"EmergencyReparentShard", "--keyspace-shard", fmt.Sprintf("%s/%s", KeyspaceName, ShardName)} + return clusterInstance.VtctldClientProcess.ExecuteCommandWithOutput(args...) +} + // endregion // region validations diff --git a/go/test/endtoend/tabletmanager/throttler_topo/throttler_test.go b/go/test/endtoend/tabletmanager/throttler_topo/throttler_test.go index 226238a46c6..48b341bf449 100644 --- a/go/test/endtoend/tabletmanager/throttler_topo/throttler_test.go +++ b/go/test/endtoend/tabletmanager/throttler_topo/throttler_test.go @@ -154,7 +154,7 @@ func TestMain(m *testing.M) { Host: clusterInstance.Hostname, Port: clusterInstance.VtgateMySQLPort, } - clusterInstance.VtctldClientProcess = *cluster.VtctldClientProcessInstance("localhost", clusterInstance.VtctldProcess.GrpcPort, clusterInstance.TmpDirectory) + clusterInstance.VtctldClientProcess = *cluster.VtctldClientProcessInstance(clusterInstance.VtctldProcess.GrpcPort, clusterInstance.TopoPort, "localhost", clusterInstance.TmpDirectory) return m.Run() }() diff --git a/go/test/endtoend/vault/vault_test.go b/go/test/endtoend/vault/vault_test.go index aab68159ca3..f1ffbf75357 100644 --- a/go/test/endtoend/vault/vault_test.go +++ b/go/test/endtoend/vault/vault_test.go @@ -243,7 +243,7 @@ func initializeClusterLate(t *testing.T) { err := clusterInstance.SetupCluster(keyspace, []cluster.Shard{*shard}) require.NoError(t, err) - vtctldClientProcess := cluster.VtctldClientProcessInstance("localhost", clusterInstance.VtctldProcess.GrpcPort, clusterInstance.TmpDirectory) + vtctldClientProcess := cluster.VtctldClientProcessInstance(clusterInstance.VtctldProcess.GrpcPort, clusterInstance.TopoPort, "localhost", clusterInstance.TmpDirectory) out, err := vtctldClientProcess.ExecuteCommandWithOutput("SetKeyspaceDurabilityPolicy", keyspaceName, "--durability-policy=semi_sync") require.NoError(t, err, out)