mirror of
https://github.com/status-im/consul.git
synced 2025-02-13 06:06:40 +00:00
This brings down the test run from 108 sec to 15 sec. There is an occasional port conflict because of the nature the next port is chosen. So far it seems rare enough to live with it.
37 lines
591 B
Go
37 lines
591 B
Go
package agent
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestStatusLeader(t *testing.T) {
|
|
t.Parallel()
|
|
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) {
|
|
t.Parallel()
|
|
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)
|
|
}
|
|
}
|