func (c *TestRingpopCluster) GetHostAddrs() []string {
	return c.hostAddrs
}
GetHostAddrs returns all host addrs within the cluster
package common
import (
	"strings"
	"time"
	"github.com/pborman/uuid"
	log "github.com/sirupsen/logrus"
	"github.com/uber/ringpop-go"
	"github.com/uber/ringpop-go/discovery/statichosts"
	"github.com/uber/ringpop-go/swim"
	"github.com/uber/tchannel-go"
)
type TestRingpopCluster struct {
	hostUUIDs    []string
	hostAddrs    []string
	hostInfoList []HostInfo
	rings        []*ringpop.Ringpop
	channels     []*tchannel.Channel
	seedNode     string
}
func NewTestRingpopCluster(name string, size int, ipAddr string, seed string, sName string) *TestRingpopCluster {
	cluster := &TestRingpopCluster{
		hostUUIDs:    make([]string, size),
		hostAddrs:    make([]string, size),
		hostInfoList: make([]HostInfo, size),
		rings:        make([]*ringpop.Ringpop, size),
		channels:     make([]*tchannel.Channel, size),
		seedNode:     seed,
	}
	for i := 0; i < size; i++ {
		var err error
		cluster.channels[i], err = tchannel.NewChannel(name, nil)
		if err != nil {
			log.WithField(TagErr, err).Error("Failed to create tchannel")
			return nil
		}
		listenAddr := ipAddr + ":0"
		err = cluster.channels[i].ListenAndServe(listenAddr)
		if err != nil {
			log.WithField(TagErr, err).Error("tchannel listen failed")
			return nil
		}
		cluster.hostUUIDs[i] = uuid.New()
		cluster.hostAddrs[i] = cluster.channels[i].PeerInfo().HostPort
		cluster.hostInfoList[i] = HostInfo{UUID: cluster.hostUUIDs[i], Addr: cluster.hostAddrs[i]}
		cluster.rings[i], err = ringpop.New(name, ringpop.Channel(cluster.channels[i]), ringpop.Address(cluster.hostAddrs[i]))
	}
	if cluster.seedNode == "" {
		cluster.seedNode = cluster.hostAddrs[0]
	}
	log.Infof("seedNode: %v", cluster.seedNode)
	bOptions := new(swim.BootstrapOptions)
	bOptions.DiscoverProvider = statichosts.New(cluster.seedNode)  
	bOptions.MaxJoinDuration = time.Duration(time.Second * 10)
	bOptions.JoinSize = 1
	for i := 0; i < size; i++ {
		_, err := cluster.rings[i].Bootstrap(bOptions)
		if err != nil {
			log.WithField(TagErr, err).Error("failed to bootstrap ringpop")
			return nil
		}
		labels, err := cluster.rings[i].Labels()
		if err != nil {
			log.Errorf("labels failed: %v", err)
		} else {
			labels.Set("serviceName", sName)
		}
	}
	return cluster
}
func (c *TestRingpopCluster) GetSeedNode() string {
	return c.seedNode
}
func (c *TestRingpopCluster) KillHost(uuid string) {
	for i := 0; i < len(c.hostUUIDs); i++ {
		if 0 == strings.Compare(c.hostUUIDs[i], uuid) {
			c.rings[i].Destroy()
			c.channels[i].Close()
			c.rings[i] = nil
			c.channels[i] = nil
		}
	}
}
func (c *TestRingpopCluster) Stop() {
	for i := 0; i < len(c.hostAddrs); i++ {
		if c.rings[i] != nil {
			c.rings[i].Destroy()
			c.channels[i].Close()
		}
	}
}
func (c *TestRingpopCluster) GetHostInfoList() []HostInfo {
	return c.hostInfoList
}