2017-02-10 01:58:20 +00:00
|
|
|
package command
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/mitchellh/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestOperator_Raft_ListPeers_Implements(t *testing.T) {
|
2017-07-21 04:24:21 +00:00
|
|
|
t.Parallel()
|
2017-02-10 01:58:20 +00:00
|
|
|
var _ cli.Command = &OperatorRaftListCommand{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestOperator_Raft_ListPeers(t *testing.T) {
|
2017-07-21 04:24:21 +00:00
|
|
|
t.Parallel()
|
2017-07-21 04:07:32 +00:00
|
|
|
s, _, addr := testServer(t, false, nil)
|
|
|
|
defer s.Shutdown()
|
2017-02-10 01:58:20 +00:00
|
|
|
|
|
|
|
ui := new(cli.MockUi)
|
|
|
|
c := &OperatorRaftListCommand{Meta: Meta{Ui: ui}}
|
|
|
|
args := []string{"-address=" + addr}
|
|
|
|
|
|
|
|
code := c.Run(args)
|
|
|
|
if code != 0 {
|
|
|
|
t.Fatalf("bad: %d. %#v", code, ui.ErrorWriter.String())
|
|
|
|
}
|
|
|
|
output := strings.TrimSpace(ui.OutputWriter.String())
|
|
|
|
if !strings.Contains(output, "leader") {
|
|
|
|
t.Fatalf("bad: %s", output)
|
|
|
|
}
|
|
|
|
}
|