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