open-nomad/command/operator_autopilot_get_test.go
2023-04-10 15:36:59 +00:00

37 lines
818 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package command
import (
"strings"
"testing"
"github.com/hashicorp/nomad/ci"
"github.com/mitchellh/cli"
)
func TestOperator_Autopilot_GetConfig_Implements(t *testing.T) {
ci.Parallel(t)
var _ cli.Command = &OperatorRaftListCommand{}
}
func TestOperatorAutopilotGetConfigCommand(t *testing.T) {
ci.Parallel(t)
s, _, addr := testServer(t, false, nil)
defer s.Shutdown()
ui := cli.NewMockUi()
c := &OperatorAutopilotGetCommand{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, "CleanupDeadServers = true") {
t.Fatalf("bad: %s", output)
}
}