open-consul/command/agent/status_endpoint_test.go

35 lines
563 B
Go

package agent
import (
"testing"
)
func TestStatusLeader(t *testing.T) {
a := NewTestAgent(t.Name(), nil)
defer a.Shutdown()
obj, err := a.srv.StatusLeader(nil, nil)
if err != nil {
t.Fatalf("Err: %v", err)
}
val := obj.(string)
if val == "" {
t.Fatalf("bad addr: %v", obj)
}
}
func TestStatusPeers(t *testing.T) {
a := NewTestAgent(t.Name(), nil)
defer a.Shutdown()
obj, err := a.srv.StatusPeers(nil, nil)
if err != nil {
t.Fatalf("Err: %v", err)
}
peers := obj.([]string)
if len(peers) != 1 {
t.Fatalf("bad peers: %v", peers)
}
}