Skip to content

Commit

Permalink
integration: configure AutoSync clientv3
Browse files Browse the repository at this point in the history
  • Loading branch information
gyuho committed Sep 1, 2016
1 parent 8181cdc commit f2f6bbb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion integration/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ type ClusterConfig struct {
DiscoveryURL string
UseGRPC bool
QuotaBackendBytes int64
ClientAutoSync time.Duration
}

type cluster struct {
Expand Down Expand Up @@ -214,6 +215,7 @@ func (c *cluster) mustNewMember(t *testing.T) *member {
peerTLS: c.cfg.PeerTLS,
clientTLS: c.cfg.ClientTLS,
quotaBackendBytes: c.cfg.QuotaBackendBytes,
clientAutoSync: c.cfg.ClientAutoSync,
})
m.DiscoveryURL = c.cfg.DiscoveryURL
if c.cfg.UseGRPC {
Expand Down Expand Up @@ -439,7 +441,8 @@ type member struct {
// PeerTLSInfo enables peer TLS when set
PeerTLSInfo *transport.TLSInfo
// ClientTLSInfo enables client TLS when set
ClientTLSInfo *transport.TLSInfo
ClientTLSInfo *transport.TLSInfo
clientAutoSync time.Duration

raftHandler *testutil.PauseableHandler
s *etcdserver.EtcdServer
Expand All @@ -457,6 +460,7 @@ type memberConfig struct {
peerTLS *transport.TLSInfo
clientTLS *transport.TLSInfo
quotaBackendBytes int64
clientAutoSync time.Duration
}

// mustNewMember return an inited member with the given name. If peerTLS is
Expand Down Expand Up @@ -484,6 +488,8 @@ func mustNewMember(t *testing.T, mcfg memberConfig) *member {
}
m.ClientTLSInfo = mcfg.clientTLS

m.clientAutoSync = mcfg.clientAutoSync

m.Name = mcfg.name

m.DataDir, err = ioutil.TempDir(os.TempDir(), "etcd")
Expand Down Expand Up @@ -540,6 +546,7 @@ func NewClientV3(m *member) (*clientv3.Client, error) {
cfg := clientv3.Config{
Endpoints: []string{m.grpcAddr},
DialTimeout: 5 * time.Second,
AutoSync: m.clientAutoSync,
}

if m.ClientTLSInfo != nil {
Expand Down Expand Up @@ -581,6 +588,7 @@ func (m *member) Clone(t *testing.T) *member {
mm.ElectionTicks = m.ElectionTicks
mm.PeerTLSInfo = m.PeerTLSInfo
mm.ClientTLSInfo = m.ClientTLSInfo
mm.clientAutoSync = m.clientAutoSync
return mm
}

Expand Down

0 comments on commit f2f6bbb

Please sign in to comment.