diff --git a/tools/benchmark/cmd/root.go b/tools/benchmark/cmd/root.go index 0b2fc725c..5a188f197 100644 --- a/tools/benchmark/cmd/root.go +++ b/tools/benchmark/cmd/root.go @@ -33,7 +33,7 @@ etcd client libray. } var ( - endpoints string + endpoints []string totalConns uint totalClients uint @@ -48,7 +48,7 @@ var ( ) func init() { - RootCmd.PersistentFlags().StringVar(&endpoints, "endpoint", "127.0.0.1:2378", "comma-separated gRPC endpoints") + RootCmd.PersistentFlags().StringSliceVar(&endpoints, "endpoints", []string{"127.0.0.1:2378"}, "gRPC endpoints") RootCmd.PersistentFlags().UintVar(&totalConns, "conns", 1, "Total number of gRPC connections") RootCmd.PersistentFlags().UintVar(&totalClients, "clients", 1, "Total number of gRPC clients") diff --git a/tools/benchmark/cmd/util.go b/tools/benchmark/cmd/util.go index b22270fe9..f76ec4331 100644 --- a/tools/benchmark/cmd/util.go +++ b/tools/benchmark/cmd/util.go @@ -18,7 +18,6 @@ import ( "crypto/rand" "fmt" "os" - "strings" "github.com/coreos/etcd/clientv3" ) @@ -30,8 +29,7 @@ var ( ) func mustCreateConn() *clientv3.Client { - eps := strings.Split(endpoints, ",") - endpoint := eps[dialTotal%len(eps)] + endpoint := endpoints[dialTotal%len(endpoints)] dialTotal++ cfgtls := &tls if cfgtls.Empty() {