Refactor testServerDC

This commit is contained in:
Armon Dadgar 2014-01-10 11:07:29 -08:00
parent 4b33ff20d0
commit 992db5d291

View File

@ -30,9 +30,13 @@ func testServer(t *testing.T) (string, *Server) {
}
func testServerDC(t *testing.T, dc string) (string, *Server) {
return testServerDCBootstrap(t, "dc1", true)
}
func testServerDCBootstrap(t *testing.T, dc string, bootstrap bool) (string, *Server) {
dir := tmpDir(t)
config := DefaultConfig()
config.Bootstrap = true
config.Bootstrap = bootstrap
config.Datacenter = dc
config.DataDir = dir
@ -60,6 +64,8 @@ func testServerDC(t *testing.T, dc string) (string, *Server) {
config.RaftConfig.HeartbeatTimeout = 40 * time.Millisecond
config.RaftConfig.ElectionTimeout = 40 * time.Millisecond
config.ReconcileInterval = 50 * time.Millisecond
server, err := NewServer(config)
if err != nil {
t.Fatalf("err: %v", err)