31 lines
634 B
Go
31 lines
634 B
Go
|
package command
|
||
|
|
||
|
import (
|
||
|
"strings"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/mitchellh/cli"
|
||
|
)
|
||
|
|
||
|
func TestOperator_Raft_ListPeers_Implements(t *testing.T) {
|
||
|
var _ cli.Command = &OperatorRaftListCommand{}
|
||
|
}
|
||
|
|
||
|
func TestOperator_Raft_ListPeers(t *testing.T) {
|
||
|
s, _, addr := testServer(t, nil)
|
||
|
defer s.Stop()
|
||
|
|
||
|
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)
|
||
|
}
|
||
|
}
|