Skip to content

Commit

Permalink
Fix unit test
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 0d136d4 commit 8d8b3b4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions go/cmd/vtctldclient/command/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"vitess.io/vitess/go/vt/topo"
"vitess.io/vitess/go/vt/topo/memorytopo"
"vitess.io/vitess/go/vt/vtctl/localvtctldclient"
"vitess.io/vitess/go/vt/vttablet/tmclient"

vtctlservicepb "vitess.io/vitess/go/vt/proto/vtctlservice"
)
Expand Down Expand Up @@ -67,15 +68,18 @@ func TestRootWithInternalVtctld(t *testing.T) {
cell := "zone1"
ts, factory := memorytopo.NewServerAndFactory(ctx, cell)
topo.RegisterFactory("test", factory)
origProtocol := command.VtctldClientProtocol
command.VtctldClientProtocol = "local"
tmclient.RegisterTabletManagerClientFactory("grpc", func() tmclient.TabletManagerClient {
return nil
})
baseArgs := []string{"vtctldclient", "--server", "internal", "--topo-implementation", "test"}

args := append([]string{}, os.Args...)
protocol := command.VtctldClientProtocol
t.Cleanup(func() {
ts.Close()
os.Args = append([]string{}, args...)
command.VtctldClientProtocol = protocol
command.VtctldClientProtocol = origProtocol
})

testCases := []struct {
Expand Down
2 changes: 2 additions & 0 deletions go/cmd/vtctldclient/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"vitess.io/vitess/go/vt/vtctl/grpcclientcommon"
"vitess.io/vitess/go/vt/vtctl/vtctlclient"
"vitess.io/vitess/go/vt/vttablet/grpctmclient"
"vitess.io/vitess/go/vt/vttablet/tmclient"

_flag "vitess.io/vitess/go/internal/flag"
)
Expand All @@ -46,6 +47,7 @@ func main() {
grpccommon.RegisterFlags(command.Root.PersistentFlags())
grpcclientcommon.RegisterFlags(command.Root.PersistentFlags())
grpctmclient.RegisterFlags(command.Root.PersistentFlags())
tmclient.RegisterFlags(command.Root.PersistentFlags())
servenv.RegisterMySQLServerFlags(command.Root.PersistentFlags())
vtctlclient.RegisterFlags(command.Root.PersistentFlags())
acl.RegisterFlags(command.Root.PersistentFlags())
Expand Down
1 change: 1 addition & 0 deletions go/cmd/vtctldclient/plugin_grpctmclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ package main

import (
_ "vitess.io/vitess/go/vt/vttablet/grpctmclient"
_ "vitess.io/vitess/go/vt/vttablet/tmclient"
)
1 change: 1 addition & 0 deletions go/flags/endtoend/vtctldclient.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ Flags:
--tablet_manager_grpc_crl string the server crl to use to validate server certificates when connecting
--tablet_manager_grpc_key string the key to use to connect
--tablet_manager_grpc_server_name string the server name to use to validate server certificate
--tablet_manager_protocol string Protocol to use to make tabletmanager RPCs to vttablets. (default "grpc")
--topo-global-root string the path of the global topology data in the global topology server (default "/vitess/global")
--topo-global-server-address strings the address of the global topology server(s) (default [localhost:2379])
--topo-implementation string the topology implementation to use (default "etcd2")
Expand Down

0 comments on commit 8d8b3b4

Please sign in to comment.