Browse Source

functional-tester: add GRPCURLs for cluster config

GRPC and v2 client address share the same host(port)
but GRPC does not work with schema specified. This fixes
it by adding another member for GRPC without schema, as
we had before.
Gyu-Ho Lee 9 years ago
parent
commit
9fb60deb7c
1 changed files with 6 additions and 4 deletions
  1. 6 4
      tools/functional-tester/etcd-tester/cluster.go

+ 6 - 4
tools/functional-tester/etcd-tester/cluster.go

@@ -44,6 +44,7 @@ type cluster struct {
 	Agents     []client.Agent
 	Agents     []client.Agent
 	Stressers  []Stresser
 	Stressers  []Stresser
 	Names      []string
 	Names      []string
+	GRPCURLs   []string
 	ClientURLs []string
 	ClientURLs []string
 }
 }
 
 
@@ -158,6 +159,7 @@ func (c *cluster) Bootstrap() error {
 	c.Agents = agents
 	c.Agents = agents
 	c.Stressers = stressers
 	c.Stressers = stressers
 	c.Names = names
 	c.Names = names
+	c.GRPCURLs = grpcURLs
 	c.ClientURLs = clientURLs
 	c.ClientURLs = clientURLs
 	return nil
 	return nil
 }
 }
@@ -168,7 +170,7 @@ func (c *cluster) WaitHealth() error {
 	// TODO: set it to a reasonable value. It is set that high because
 	// TODO: set it to a reasonable value. It is set that high because
 	// follower may use long time to catch up the leader when reboot under
 	// follower may use long time to catch up the leader when reboot under
 	// reasonable workload (https://github.com/coreos/etcd/issues/2698)
 	// reasonable workload (https://github.com/coreos/etcd/issues/2698)
-	healthFunc, urls := setHealthKey, c.ClientURLs
+	healthFunc, urls := setHealthKey, c.GRPCURLs
 	if c.v2Only {
 	if c.v2Only {
 		healthFunc, urls = setHealthKeyV2, c.ClientURLs
 		healthFunc, urls = setHealthKeyV2, c.ClientURLs
 	}
 	}
@@ -188,7 +190,7 @@ func (c *cluster) GetLeader() (int, error) {
 		return 0, nil
 		return 0, nil
 	}
 	}
 	cli, err := clientv3.New(clientv3.Config{
 	cli, err := clientv3.New(clientv3.Config{
-		Endpoints:   c.ClientURLs,
+		Endpoints:   c.GRPCURLs,
 		DialTimeout: 5 * time.Second,
 		DialTimeout: 5 * time.Second,
 	})
 	})
 	if err != nil {
 	if err != nil {
@@ -300,7 +302,7 @@ func setHealthKeyV2(us []string) error {
 func (c *cluster) getRevisionHash() (map[string]int64, map[string]int64, error) {
 func (c *cluster) getRevisionHash() (map[string]int64, map[string]int64, error) {
 	revs := make(map[string]int64)
 	revs := make(map[string]int64)
 	hashes := make(map[string]int64)
 	hashes := make(map[string]int64)
-	for _, u := range c.ClientURLs {
+	for _, u := range c.GRPCURLs {
 		conn, err := grpc.Dial(u, grpc.WithInsecure(), grpc.WithTimeout(5*time.Second))
 		conn, err := grpc.Dial(u, grpc.WithInsecure(), grpc.WithTimeout(5*time.Second))
 		if err != nil {
 		if err != nil {
 			return nil, nil, err
 			return nil, nil, err
@@ -324,7 +326,7 @@ func (c *cluster) compactKV(rev int64) error {
 		conn *grpc.ClientConn
 		conn *grpc.ClientConn
 		err  error
 		err  error
 	)
 	)
-	for _, u := range c.ClientURLs {
+	for _, u := range c.GRPCURLs {
 		conn, err = grpc.Dial(u, grpc.WithInsecure(), grpc.WithTimeout(5*time.Second))
 		conn, err = grpc.Dial(u, grpc.WithInsecure(), grpc.WithTimeout(5*time.Second))
 		if err != nil {
 		if err != nil {
 			continue
 			continue