open-nomad/command/check_test.go

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
586 B
Go
Raw Normal View History

package command
import (
"fmt"
"testing"
"github.com/hashicorp/nomad/ci"
"github.com/mitchellh/cli"
"github.com/shoenig/test/must"
)
func TestAgentCheckCommand_ServerHealth(t *testing.T) {
ci.Parallel(t)
2017-07-21 04:07:32 +00:00
srv, _, url := testServer(t, false, nil)
defer srv.Shutdown()
2020-10-05 14:07:41 +00:00
ui := cli.NewMockUi()
cmd := &AgentCheckCommand{Meta: Meta{Ui: ui}}
address := fmt.Sprintf("-address=%s", url)
code := cmd.Run([]string{address})
must.Eq(t, HealthPass, code)
minPeers := fmt.Sprintf("-min-peers=%v", 3)
code = cmd.Run([]string{address, minPeers})
must.Eq(t, HealthCritical, code)
}