github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/command/operator_autopilot_get_test.go (about) 1 package command 2 3 import ( 4 "strings" 5 "testing" 6 7 "github.com/mitchellh/cli" 8 ) 9 10 func TestOperator_Autopilot_GetConfig_Implements(t *testing.T) { 11 t.Parallel() 12 var _ cli.Command = &OperatorRaftListCommand{} 13 } 14 15 func TestOperatorAutopilotGetConfigCommand(t *testing.T) { 16 t.Parallel() 17 s, _, addr := testServer(t, false, nil) 18 defer s.Shutdown() 19 20 ui := cli.NewMockUi() 21 c := &OperatorAutopilotGetCommand{Meta: Meta{Ui: ui}} 22 args := []string{"-address=" + addr} 23 24 code := c.Run(args) 25 if code != 0 { 26 t.Fatalf("bad: %d. %#v", code, ui.ErrorWriter.String()) 27 } 28 output := strings.TrimSpace(ui.OutputWriter.String()) 29 if !strings.Contains(output, "CleanupDeadServers = true") { 30 t.Fatalf("bad: %s", output) 31 } 32 }