github.com/diptanu/nomad@v0.5.7-0.20170516172507-d72e86cbe3d9/command/operator_raft_remove_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_RemovePeers_Implements(t *testing.T) { 11 var _ cli.Command = &OperatorRaftRemoveCommand{} 12 } 13 14 func TestOperator_Raft_RemovePeer(t *testing.T) { 15 s, _, addr := testServer(t, nil) 16 defer s.Stop() 17 18 ui := new(cli.MockUi) 19 c := &OperatorRaftRemoveCommand{Meta: Meta{Ui: ui}} 20 args := []string{"-address=" + addr, "-peer-address=nope"} 21 22 code := c.Run(args) 23 if code != 1 { 24 t.Fatalf("bad: %d. %#v", code, ui.ErrorWriter.String()) 25 } 26 27 // If we get this error, it proves we sent the address all they through. 28 output := strings.TrimSpace(ui.ErrorWriter.String()) 29 if !strings.Contains(output, "address \"nope\" was not found in the Raft configuration") { 30 t.Fatalf("bad: %s", output) 31 } 32 }