Browse Source

etcd: add a bootstrap test

Xiang Li 11 years ago
parent
commit
d7eef6a64e
1 changed files with 15 additions and 0 deletions
  1. 15 0
      etcd/etcd_start_test.go

+ 15 - 0
etcd/etcd_start_test.go

@@ -98,6 +98,21 @@ func TestBadDiscoveryServiceWithAdvisedPeers(t *testing.T) {
 	afterTest(t)
 	afterTest(t)
 }
 }
 
 
+func TestBootstrapByEmptyPeers(t *testing.T) {
+	c := config.New()
+	id := genId()
+	e, h, err := buildServer(c, id)
+
+	if err != nil {
+		t.Error(err)
+	}
+	if e.p.node.Leader() != id {
+		t.Error("leader = %x, want %x", e.p.node.Leader(), id)
+	}
+	destroyServer(e, h)
+	afterTest(t)
+}
+
 func TestBootstrapByDiscoveryService(t *testing.T) {
 func TestBootstrapByDiscoveryService(t *testing.T) {
 	de, dh, _ := buildServer(config.New(), genId())
 	de, dh, _ := buildServer(config.New(), genId())