2015-09-12 00:02:56 +00:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2022-03-17 13:34:57 +00:00
|
|
|
|
|
|
|
"github.com/hashicorp/nomad/api/internal/testutil"
|
2015-09-12 00:02:56 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestStatus_Leader(t *testing.T) {
|
2022-03-17 13:34:57 +00:00
|
|
|
testutil.Parallel(t)
|
2015-09-12 00:02:56 +00:00
|
|
|
c, s := makeClient(t, nil, nil)
|
|
|
|
defer s.Stop()
|
|
|
|
status := c.Status()
|
|
|
|
|
|
|
|
// Query for leader status should return a result
|
|
|
|
out, err := status.Leader()
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("err: %s", err)
|
|
|
|
}
|
|
|
|
if out == "" {
|
|
|
|
t.Fatalf("expected leader, got: %q", out)
|
|
|
|
}
|
|
|
|
}
|