2015-01-06 18:40:00 +00:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
2015-01-16 18:56:47 +00:00
|
|
|
func TestStatusLeader(t *testing.T) {
|
2015-01-06 23:26:50 +00:00
|
|
|
c, s := makeClient(t)
|
2015-03-03 02:18:38 +00:00
|
|
|
defer s.Stop()
|
2015-01-06 23:26:50 +00:00
|
|
|
|
2015-01-06 18:40:00 +00:00
|
|
|
status := c.Status()
|
|
|
|
|
|
|
|
leader, err := status.Leader()
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("err: %v", err)
|
|
|
|
}
|
|
|
|
if leader == "" {
|
|
|
|
t.Fatalf("Expected leader")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestStatusPeers(t *testing.T) {
|
2015-01-06 23:26:50 +00:00
|
|
|
c, s := makeClient(t)
|
2015-03-03 02:18:38 +00:00
|
|
|
defer s.Stop()
|
2015-01-06 23:26:50 +00:00
|
|
|
|
2015-01-06 18:40:00 +00:00
|
|
|
status := c.Status()
|
|
|
|
|
|
|
|
peers, err := status.Peers()
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("err: %v", err)
|
|
|
|
}
|
|
|
|
if len(peers) == 0 {
|
|
|
|
t.Fatalf("Expected peers ")
|
|
|
|
}
|
|
|
|
}
|