github.com/diptanu/nomad@v0.5.7-0.20170516172507-d72e86cbe3d9/command/operator_raft_list_test.go (about) 1 package command 2 3 import ( 4 "strings" 5 "testing" 6 7 "github.com/mitchellh/cli" 8 ) 9 10 func TestOperator_Raft_ListPeers_Implements(t *testing.T) { 11 var _ cli.Command = &OperatorRaftListCommand{} 12 } 13 14 func TestOperator_Raft_ListPeers(t *testing.T) { 15 s, _, addr := testServer(t, nil) 16 defer s.Stop() 17 18 ui := new(cli.MockUi) 19 c := &OperatorRaftListCommand{Meta: Meta{Ui: ui}} 20 args := []string{"-address=" + addr} 21 22 code := c.Run(args) 23 if code != 0 { 24 t.Fatalf("bad: %d. %#v", code, ui.ErrorWriter.String()) 25 } 26 output := strings.TrimSpace(ui.OutputWriter.String()) 27 if !strings.Contains(output, "leader") { 28 t.Fatalf("bad: %s", output) 29 } 30 }