Merge pull request #9027 from hashicorp/f-gh-9026

cli: move tests to use NewMockUi func.
This commit is contained in:
James Rasell 2020-10-06 08:28:18 +02:00 committed by GitHub
commit ffe6533ad1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
78 changed files with 188 additions and 188 deletions

View File

@ -23,7 +23,7 @@ func TestACLBootstrapCommand(t *testing.T) {
assert.Nil(srv.RootToken) assert.Nil(srv.RootToken)
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &ACLBootstrapCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &ACLBootstrapCommand{Meta: Meta{Ui: ui, flagAddress: url}}
code := cmd.Run([]string{"-address=" + url}) code := cmd.Run([]string{"-address=" + url})
@ -48,7 +48,7 @@ func TestACLBootstrapCommand_ExistingBootstrapToken(t *testing.T) {
assert.NotNil(srv.RootToken) assert.NotNil(srv.RootToken)
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &ACLBootstrapCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &ACLBootstrapCommand{Meta: Meta{Ui: ui, flagAddress: url}}
code := cmd.Run([]string{"-address=" + url}) code := cmd.Run([]string{"-address=" + url})
@ -66,7 +66,7 @@ func TestACLBootstrapCommand_NonACLServer(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &ACLBootstrapCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &ACLBootstrapCommand{Meta: Meta{Ui: ui, flagAddress: url}}
code := cmd.Run([]string{"-address=" + url}) code := cmd.Run([]string{"-address=" + url})

View File

@ -26,7 +26,7 @@ func TestACLPolicyApplyCommand(t *testing.T) {
token := srv.RootToken token := srv.RootToken
assert.NotNil(token, "failed to bootstrap ACL token") assert.NotNil(token, "failed to bootstrap ACL token")
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &ACLPolicyApplyCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &ACLPolicyApplyCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a test policy // Create a test policy

View File

@ -36,7 +36,7 @@ func TestACLPolicyDeleteCommand(t *testing.T) {
policy.SetHash() policy.SetHash()
assert.Nil(state.UpsertACLPolicies(1000, []*structs.ACLPolicy{policy})) assert.Nil(state.UpsertACLPolicies(1000, []*structs.ACLPolicy{policy}))
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &ACLPolicyDeleteCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &ACLPolicyDeleteCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Delete the policy without a valid token fails // Delete the policy without a valid token fails

View File

@ -34,7 +34,7 @@ func TestACLPolicyInfoCommand(t *testing.T) {
policy.SetHash() policy.SetHash()
assert.Nil(state.UpsertACLPolicies(1000, []*structs.ACLPolicy{policy})) assert.Nil(state.UpsertACLPolicies(1000, []*structs.ACLPolicy{policy}))
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &ACLPolicyInfoCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &ACLPolicyInfoCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Attempt to apply a policy without a valid management token // Attempt to apply a policy without a valid management token

View File

@ -35,7 +35,7 @@ func TestACLPolicyListCommand(t *testing.T) {
policy.SetHash() policy.SetHash()
assert.Nil(state.UpsertACLPolicies(1000, []*structs.ACLPolicy{policy})) assert.Nil(state.UpsertACLPolicies(1000, []*structs.ACLPolicy{policy}))
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &ACLPolicyListCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &ACLPolicyListCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Attempt to list policies without a valid management token // Attempt to list policies without a valid management token

View File

@ -23,7 +23,7 @@ func TestACLTokenCreateCommand(t *testing.T) {
token := srv.RootToken token := srv.RootToken
assert.NotNil(token, "failed to bootstrap ACL token") assert.NotNil(token, "failed to bootstrap ACL token")
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &ACLTokenCreateCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &ACLTokenCreateCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Request to create a new token without providing a valid management token // Request to create a new token without providing a valid management token

View File

@ -27,7 +27,7 @@ func TestACLTokenDeleteCommand_ViaEnvVariable(t *testing.T) {
token := srv.RootToken token := srv.RootToken
assert.NotNil(token, "failed to bootstrap ACL token") assert.NotNil(token, "failed to bootstrap ACL token")
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &ACLTokenDeleteCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &ACLTokenDeleteCommand{Meta: Meta{Ui: ui, flagAddress: url}}
state := srv.Agent.Server().State() state := srv.Agent.Server().State()

View File

@ -30,7 +30,7 @@ func TestACLTokenInfoCommand_ViaEnvVar(t *testing.T) {
token := srv.RootToken token := srv.RootToken
assert.NotNil(token, "failed to bootstrap ACL token") assert.NotNil(token, "failed to bootstrap ACL token")
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &ACLTokenInfoCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &ACLTokenInfoCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a valid token // Create a valid token

View File

@ -33,7 +33,7 @@ func TestACLTokenListCommand(t *testing.T) {
mockToken.SetHash() mockToken.SetHash()
assert.Nil(state.UpsertACLTokens(1000, []*structs.ACLToken{mockToken})) assert.Nil(state.UpsertACLTokens(1000, []*structs.ACLToken{mockToken}))
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &ACLTokenListCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &ACLTokenListCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Attempt to list tokens without a valid management token // Attempt to list tokens without a valid management token

View File

@ -30,7 +30,7 @@ func TestACLTokenSelfCommand_ViaEnvVar(t *testing.T) {
token := srv.RootToken token := srv.RootToken
assert.NotNil(token, "failed to bootstrap ACL token") assert.NotNil(token, "failed to bootstrap ACL token")
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &ACLTokenSelfCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &ACLTokenSelfCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a valid token // Create a valid token

View File

@ -25,7 +25,7 @@ func TestACLTokenUpdateCommand(t *testing.T) {
token := srv.RootToken token := srv.RootToken
assert.NotNil(token, "failed to bootstrap ACL token") assert.NotNil(token, "failed to bootstrap ACL token")
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &ACLTokenUpdateCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &ACLTokenUpdateCommand{Meta: Meta{Ui: ui, flagAddress: url}}
state := srv.Agent.Server().State() state := srv.Agent.Server().State()

View File

@ -66,7 +66,7 @@ func TestCommand_Args(t *testing.T) {
for _, tc := range tcases { for _, tc := range tcases {
// Make a new command. We preemptively close the shutdownCh // Make a new command. We preemptively close the shutdownCh
// so that the command exits immediately instead of blocking. // so that the command exits immediately instead of blocking.
ui := new(cli.MockUi) ui := cli.NewMockUi()
shutdownCh := make(chan struct{}) shutdownCh := make(chan struct{})
close(shutdownCh) close(shutdownCh)
cmd := &Command{ cmd := &Command{
@ -120,7 +120,7 @@ func TestCommand_MetaConfigValidation(t *testing.T) {
// Make a new command. We preemptively close the shutdownCh // Make a new command. We preemptively close the shutdownCh
// so that the command exits immediately instead of blocking. // so that the command exits immediately instead of blocking.
ui := new(cli.MockUi) ui := cli.NewMockUi()
shutdownCh := make(chan struct{}) shutdownCh := make(chan struct{})
close(shutdownCh) close(shutdownCh)
cmd := &Command{ cmd := &Command{

View File

@ -17,7 +17,7 @@ func TestAgentInfoCommand_Run(t *testing.T) {
srv, _, url := testServer(t, false, nil) srv, _, url := testServer(t, false, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AgentInfoCommand{Meta: Meta{Ui: ui}} cmd := &AgentInfoCommand{Meta: Meta{Ui: ui}}
code := cmd.Run([]string{"-address=" + url}) code := cmd.Run([]string{"-address=" + url})
@ -28,7 +28,7 @@ func TestAgentInfoCommand_Run(t *testing.T) {
func TestAgentInfoCommand_Fails(t *testing.T) { func TestAgentInfoCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AgentInfoCommand{Meta: Meta{Ui: ui}} cmd := &AgentInfoCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse

View File

@ -17,7 +17,7 @@ func TestMonitorCommand_Fails(t *testing.T) {
srv, _, url := testServer(t, false, nil) srv, _, url := testServer(t, false, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &MonitorCommand{Meta: Meta{Ui: ui}} cmd := &MonitorCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse

View File

@ -68,7 +68,7 @@ func TestAllocExecCommand_Fails(t *testing.T) {
for _, c := range cases { for _, c := range cases {
t.Run(c.name, func(t *testing.T) { t.Run(c.name, func(t *testing.T) {
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AllocExecCommand{Meta: Meta{Ui: ui}} cmd := &AllocExecCommand{Meta: Meta{Ui: ui}}
code := cmd.Run(c.args) code := cmd.Run(c.args)
@ -100,7 +100,7 @@ func TestAllocExecCommand_Fails(t *testing.T) {
}) })
t.Run("non existent task", func(t *testing.T) { t.Run("non existent task", func(t *testing.T) {
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AllocExecCommand{Meta: Meta{Ui: ui}} cmd := &AllocExecCommand{Meta: Meta{Ui: ui}}
jobID := "job1_sfx" jobID := "job1_sfx"
@ -139,7 +139,7 @@ func TestAllocExecCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AllocExecCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &AllocExecCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake alloc // Create a fake alloc
@ -193,7 +193,7 @@ func TestAllocExecCommand_Run(t *testing.T) {
resp, _, err := client.Jobs().Register(job, nil) resp, _, err := client.Jobs().Register(job, nil)
require.NoError(t, err) require.NoError(t, err)
evalUi := new(cli.MockUi) evalUi := cli.NewMockUi()
code := waitForSuccess(evalUi, client, fullId, t, resp.EvalID) code := waitForSuccess(evalUi, client, fullId, t, resp.EvalID)
require.Equal(t, 0, code, "failed to get status - output: %v", evalUi.ErrorWriter.String()) require.Equal(t, 0, code, "failed to get status - output: %v", evalUi.ErrorWriter.String())
@ -249,7 +249,7 @@ func TestAllocExecCommand_Run(t *testing.T) {
for _, c := range cases { for _, c := range cases {
t.Run("by id: "+c.name, func(t *testing.T) { t.Run("by id: "+c.name, func(t *testing.T) {
ui := new(cli.MockUi) ui := cli.NewMockUi()
var stdout, stderr bufferCloser var stdout, stderr bufferCloser
cmd := &AllocExecCommand{ cmd := &AllocExecCommand{
@ -265,7 +265,7 @@ func TestAllocExecCommand_Run(t *testing.T) {
assert.Equal(t, c.stderr, strings.TrimSpace(stderr.String())) assert.Equal(t, c.stderr, strings.TrimSpace(stderr.String()))
}) })
t.Run("by job: "+c.name, func(t *testing.T) { t.Run("by job: "+c.name, func(t *testing.T) {
ui := new(cli.MockUi) ui := cli.NewMockUi()
var stdout, stderr bufferCloser var stdout, stderr bufferCloser
cmd := &AllocExecCommand{ cmd := &AllocExecCommand{

View File

@ -21,7 +21,7 @@ func TestFSCommand_Fails(t *testing.T) {
srv, _, url := testServer(t, false, nil) srv, _, url := testServer(t, false, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AllocFSCommand{Meta: Meta{Ui: ui}} cmd := &AllocFSCommand{Meta: Meta{Ui: ui}}
// Fails on lack of job ID // Fails on lack of job ID
@ -94,7 +94,7 @@ func TestFSCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AllocFSCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &AllocFSCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake alloc // Create a fake alloc

View File

@ -21,7 +21,7 @@ func TestLogsCommand_Fails(t *testing.T) {
srv, _, url := testServer(t, false, nil) srv, _, url := testServer(t, false, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AllocLogsCommand{Meta: Meta{Ui: ui}} cmd := &AllocLogsCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -76,7 +76,7 @@ func TestLogsCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AllocLogsCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &AllocLogsCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake alloc // Create a fake alloc

View File

@ -23,7 +23,7 @@ func TestAllocRestartCommand_Fails(t *testing.T) {
defer srv.Shutdown() defer srv.Shutdown()
require := require.New(t) require := require.New(t)
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AllocRestartCommand{Meta: Meta{Ui: ui}} cmd := &AllocRestartCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -113,7 +113,7 @@ func TestAllocRestartCommand_Run(t *testing.T) {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
}) })
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AllocRestartCommand{Meta: Meta{Ui: ui}} cmd := &AllocRestartCommand{Meta: Meta{Ui: ui}}
jobID := "job1_sfx" jobID := "job1_sfx"
@ -157,7 +157,7 @@ func TestAllocRestartCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AllocRestartCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &AllocRestartCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake alloc // Create a fake alloc

View File

@ -26,7 +26,7 @@ func TestAllocSignalCommand_Fails(t *testing.T) {
require := require.New(t) require := require.New(t)
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AllocSignalCommand{Meta: Meta{Ui: ui}} cmd := &AllocSignalCommand{Meta: Meta{Ui: ui}}
// Fails on lack of alloc ID // Fails on lack of alloc ID
@ -62,7 +62,7 @@ func TestAllocSignalCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AllocSignalCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &AllocSignalCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake alloc // Create a fake alloc
@ -103,7 +103,7 @@ func TestAllocSignalCommand_Run(t *testing.T) {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
}) })
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AllocSignalCommand{Meta: Meta{Ui: ui}} cmd := &AllocSignalCommand{Meta: Meta{Ui: ui}}
jobID := "job1_sfx" jobID := "job1_sfx"

View File

@ -30,7 +30,7 @@ func TestAllocStatusCommand_Fails(t *testing.T) {
srv, _, url := testServer(t, false, nil) srv, _, url := testServer(t, false, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AllocStatusCommand{Meta: Meta{Ui: ui}} cmd := &AllocStatusCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -108,7 +108,7 @@ func TestAllocStatusCommand_LifecycleInfo(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
}) })
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AllocStatusCommand{Meta: Meta{Ui: ui}} cmd := &AllocStatusCommand{Meta: Meta{Ui: ui}}
state := srv.Agent.Server().State() state := srv.Agent.Server().State()
@ -172,7 +172,7 @@ func TestAllocStatusCommand_Run(t *testing.T) {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
}) })
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AllocStatusCommand{Meta: Meta{Ui: ui}} cmd := &AllocStatusCommand{Meta: Meta{Ui: ui}}
jobID := "job1_sfx" jobID := "job1_sfx"
@ -268,7 +268,7 @@ func TestAllocStatusCommand_RescheduleInfo(t *testing.T) {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
}) })
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AllocStatusCommand{Meta: Meta{Ui: ui}} cmd := &AllocStatusCommand{Meta: Meta{Ui: ui}}
// Test reschedule attempt info // Test reschedule attempt info
require := require.New(t) require := require.New(t)
@ -317,7 +317,7 @@ func TestAllocStatusCommand_ScoreMetrics(t *testing.T) {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
}) })
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AllocStatusCommand{Meta: Meta{Ui: ui}} cmd := &AllocStatusCommand{Meta: Meta{Ui: ui}}
// Test node metrics // Test node metrics
require := require.New(t) require := require.New(t)
@ -365,7 +365,7 @@ func TestAllocStatusCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AllocStatusCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &AllocStatusCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake alloc // Create a fake alloc
@ -439,7 +439,7 @@ func TestAllocStatusCommand_HostVolumes(t *testing.T) {
require.NoError(t, state.UpsertJobSummary(1004, summary)) require.NoError(t, state.UpsertJobSummary(1004, summary))
require.NoError(t, state.UpsertAllocs(1005, []*structs.Allocation{alloc})) require.NoError(t, state.UpsertAllocs(1005, []*structs.Allocation{alloc}))
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AllocStatusCommand{Meta: Meta{Ui: ui}} cmd := &AllocStatusCommand{Meta: Meta{Ui: ui}}
if code := cmd.Run([]string{"-address=" + url, "-verbose", alloc.ID}); code != 0 { if code := cmd.Run([]string{"-address=" + url, "-verbose", alloc.ID}); code != 0 {
t.Fatalf("expected exit 0, got: %d", code) t.Fatalf("expected exit 0, got: %d", code)
@ -514,7 +514,7 @@ func TestAllocStatusCommand_CSIVolumes(t *testing.T) {
require.NoError(t, state.UpsertJobSummary(1004, summary)) require.NoError(t, state.UpsertJobSummary(1004, summary))
require.NoError(t, state.UpsertAllocs(1005, []*structs.Allocation{alloc})) require.NoError(t, state.UpsertAllocs(1005, []*structs.Allocation{alloc}))
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AllocStatusCommand{Meta: Meta{Ui: ui}} cmd := &AllocStatusCommand{Meta: Meta{Ui: ui}}
if code := cmd.Run([]string{"-address=" + url, "-verbose", alloc.ID}); code != 0 { if code := cmd.Run([]string{"-address=" + url, "-verbose", alloc.ID}); code != 0 {
t.Fatalf("expected exit 0, got: %d", code) t.Fatalf("expected exit 0, got: %d", code)

View File

@ -21,7 +21,7 @@ func TestAllocStop_Fails(t *testing.T) {
defer srv.Shutdown() defer srv.Shutdown()
require := require.New(t) require := require.New(t)
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AllocStopCommand{Meta: Meta{Ui: ui}} cmd := &AllocStopCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -73,7 +73,7 @@ func TestAllocStop_Run(t *testing.T) {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
}) })
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AllocStopCommand{Meta: Meta{Ui: ui}} cmd := &AllocStopCommand{Meta: Meta{Ui: ui}}
jobID := "job1_sfx" jobID := "job1_sfx"

View File

@ -12,7 +12,7 @@ func TestAgentCheckCommand_ServerHealth(t *testing.T) {
srv, _, url := testServer(t, false, nil) srv, _, url := testServer(t, false, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &AgentCheckCommand{Meta: Meta{Ui: ui}} cmd := &AgentCheckCommand{Meta: Meta{Ui: ui}}
address := fmt.Sprintf("-address=%s", url) address := fmt.Sprintf("-address=%s", url)

View File

@ -17,7 +17,7 @@ func TestDeploymentFailCommand_Implements(t *testing.T) {
func TestDeploymentFailCommand_Fails(t *testing.T) { func TestDeploymentFailCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &DeploymentFailCommand{Meta: Meta{Ui: ui}} cmd := &DeploymentFailCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -45,7 +45,7 @@ func TestDeploymentFailCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &DeploymentFailCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &DeploymentFailCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake deployment // Create a fake deployment

View File

@ -14,7 +14,7 @@ func TestDeploymentListCommand_Implements(t *testing.T) {
func TestDeploymentListCommand_Fails(t *testing.T) { func TestDeploymentListCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &DeploymentListCommand{Meta: Meta{Ui: ui}} cmd := &DeploymentListCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse

View File

@ -17,7 +17,7 @@ func TestDeploymentPauseCommand_Implements(t *testing.T) {
func TestDeploymentPauseCommand_Fails(t *testing.T) { func TestDeploymentPauseCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &DeploymentPauseCommand{Meta: Meta{Ui: ui}} cmd := &DeploymentPauseCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -45,7 +45,7 @@ func TestDeploymentPauseCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &DeploymentPauseCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &DeploymentPauseCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake deployment // Create a fake deployment

View File

@ -17,7 +17,7 @@ func TestDeploymentPromoteCommand_Implements(t *testing.T) {
func TestDeploymentPromoteCommand_Fails(t *testing.T) { func TestDeploymentPromoteCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &DeploymentPromoteCommand{Meta: Meta{Ui: ui}} cmd := &DeploymentPromoteCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -45,7 +45,7 @@ func TestDeploymentPromoteCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &DeploymentPromoteCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &DeploymentPromoteCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake deployment // Create a fake deployment

View File

@ -17,7 +17,7 @@ func TestDeploymentResumeCommand_Implements(t *testing.T) {
func TestDeploymentResumeCommand_Fails(t *testing.T) { func TestDeploymentResumeCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &DeploymentResumeCommand{Meta: Meta{Ui: ui}} cmd := &DeploymentResumeCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -45,7 +45,7 @@ func TestDeploymentResumeCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &DeploymentResumeCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &DeploymentResumeCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake deployment // Create a fake deployment

View File

@ -17,7 +17,7 @@ func TestDeploymentStatusCommand_Implements(t *testing.T) {
func TestDeploymentStatusCommand_Fails(t *testing.T) { func TestDeploymentStatusCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &DeploymentStatusCommand{Meta: Meta{Ui: ui}} cmd := &DeploymentStatusCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -48,7 +48,7 @@ func TestDeploymentStatusCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &DeploymentStatusCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &DeploymentStatusCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake deployment // Create a fake deployment

View File

@ -17,7 +17,7 @@ func TestDeploymentUnblockCommand_Implements(t *testing.T) {
func TestDeploymentUnblockCommand_Fails(t *testing.T) { func TestDeploymentUnblockCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &DeploymentUnblockCommand{Meta: Meta{Ui: ui}} cmd := &DeploymentUnblockCommand{Meta: Meta{Ui: ui}}
// Unblocks on misuse // Unblocks on misuse
@ -45,7 +45,7 @@ func TestDeploymentUnblockCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &DeploymentUnblockCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &DeploymentUnblockCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake deployment // Create a fake deployment

View File

@ -21,7 +21,7 @@ func TestEvalStatusCommand_Fails(t *testing.T) {
srv, _, url := testServer(t, false, nil) srv, _, url := testServer(t, false, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &EvalStatusCommand{Meta: Meta{Ui: ui}} cmd := &EvalStatusCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -68,7 +68,7 @@ func TestEvalStatusCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &EvalStatusCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &EvalStatusCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake eval // Create a fake eval

View File

@ -51,7 +51,7 @@ func TestHelpers_NodeID(t *testing.T) {
srv, _, _ := testServer(t, false, nil) srv, _, _ := testServer(t, false, nil)
defer srv.Shutdown() defer srv.Shutdown()
meta := Meta{Ui: new(cli.MockUi)} meta := Meta{Ui: cli.NewMockUi()}
client, err := meta.Client() client, err := meta.Client()
if err != nil { if err != nil {
t.FailNow() t.FailNow()

View File

@ -17,7 +17,7 @@ func TestJobDeploymentsCommand_Implements(t *testing.T) {
func TestJobDeploymentsCommand_Fails(t *testing.T) { func TestJobDeploymentsCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobDeploymentsCommand{Meta: Meta{Ui: ui}} cmd := &JobDeploymentsCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -44,7 +44,7 @@ func TestJobDeploymentsCommand_Run(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobDeploymentsCommand{Meta: Meta{Ui: ui}} cmd := &JobDeploymentsCommand{Meta: Meta{Ui: ui}}
// Should return an error message for no job match // Should return an error message for no job match
@ -88,7 +88,7 @@ func TestJobDeploymentsCommand_Run_Latest(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobDeploymentsCommand{Meta: Meta{Ui: ui}} cmd := &JobDeploymentsCommand{Meta: Meta{Ui: ui}}
// Should return an error message for no job match // Should return an error message for no job match
@ -133,7 +133,7 @@ func TestJobDeploymentsCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobDeploymentsCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &JobDeploymentsCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake job // Create a fake job

View File

@ -17,7 +17,7 @@ func TestJobDispatchCommand_Implements(t *testing.T) {
func TestJobDispatchCommand_Fails(t *testing.T) { func TestJobDispatchCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobDispatchCommand{Meta: Meta{Ui: ui}} cmd := &JobDispatchCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -54,7 +54,7 @@ func TestJobDispatchCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobDispatchCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &JobDispatchCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake job // Create a fake job

View File

@ -22,7 +22,7 @@ func TestJobEvalCommand_Implements(t *testing.T) {
func TestJobEvalCommand_Fails(t *testing.T) { func TestJobEvalCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobEvalCommand{Meta: Meta{Ui: ui}} cmd := &JobEvalCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -66,7 +66,7 @@ func TestJobEvalCommand_Run(t *testing.T) {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
}) })
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobEvalCommand{Meta: Meta{Ui: ui}} cmd := &JobEvalCommand{Meta: Meta{Ui: ui}}
require := require.New(t) require := require.New(t)
@ -109,7 +109,7 @@ func TestJobEvalCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobEvalCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &JobEvalCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake job // Create a fake job

View File

@ -17,7 +17,7 @@ func TestJobHistoryCommand_Implements(t *testing.T) {
func TestJobHistoryCommand_Fails(t *testing.T) { func TestJobHistoryCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobHistoryCommand{Meta: Meta{Ui: ui}} cmd := &JobHistoryCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -45,7 +45,7 @@ func TestJobHistoryCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobHistoryCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &JobHistoryCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake job // Create a fake job

View File

@ -17,7 +17,7 @@ func TestInitCommand_Implements(t *testing.T) {
func TestInitCommand_Run(t *testing.T) { func TestInitCommand_Run(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobInitCommand{Meta: Meta{Ui: ui}} cmd := &JobInitCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -91,7 +91,7 @@ func TestInitCommand_defaultJob(t *testing.T) {
func TestInitCommand_customFilename(t *testing.T) { func TestInitCommand_customFilename(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobInitCommand{Meta: Meta{Ui: ui}} cmd := &JobInitCommand{Meta: Meta{Ui: ui}}
filename := "custom.nomad" filename := "custom.nomad"

View File

@ -20,7 +20,7 @@ func TestInspectCommand_Fails(t *testing.T) {
srv, _, url := testServer(t, false, nil) srv, _, url := testServer(t, false, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobInspectCommand{Meta: Meta{Ui: ui}} cmd := &JobInspectCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -66,7 +66,7 @@ func TestInspectCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobInspectCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &JobInspectCommand{Meta: Meta{Ui: ui, flagAddress: url}}
state := srv.Agent.Server().State() state := srv.Agent.Server().State()

View File

@ -21,7 +21,7 @@ func TestJobPeriodicForceCommand_Implements(t *testing.T) {
func TestJobPeriodicForceCommand_Fails(t *testing.T) { func TestJobPeriodicForceCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobPeriodicForceCommand{Meta: Meta{Ui: ui}} cmd := &JobPeriodicForceCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -43,7 +43,7 @@ func TestJobPeriodicForceCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobPeriodicForceCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &JobPeriodicForceCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake job, not periodic // Create a fake job, not periodic
@ -98,7 +98,7 @@ func TestJobPeriodicForceCommand_NonPeriodicJob(t *testing.T) {
// Register a job // Register a job
j := testJob("job_not_periodic") j := testJob("job_not_periodic")
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobPeriodicForceCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &JobPeriodicForceCommand{Meta: Meta{Ui: ui, flagAddress: url}}
resp, _, err := client.Jobs().Register(j, nil) resp, _, err := client.Jobs().Register(j, nil)
@ -141,7 +141,7 @@ func TestJobPeriodicForceCommand_SuccessfulPeriodicForceDetach(t *testing.T) {
TimeZone: helper.StringToPtr("Europe/Minsk"), TimeZone: helper.StringToPtr("Europe/Minsk"),
} }
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobPeriodicForceCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &JobPeriodicForceCommand{Meta: Meta{Ui: ui, flagAddress: url}}
_, _, err := client.Jobs().Register(j, nil) _, _, err := client.Jobs().Register(j, nil)
@ -183,7 +183,7 @@ func TestJobPeriodicForceCommand_SuccessfulPeriodicForce(t *testing.T) {
TimeZone: helper.StringToPtr("Europe/Minsk"), TimeZone: helper.StringToPtr("Europe/Minsk"),
} }
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobPeriodicForceCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &JobPeriodicForceCommand{Meta: Meta{Ui: ui, flagAddress: url}}
_, _, err := client.Jobs().Register(j, nil) _, _, err := client.Jobs().Register(j, nil)

View File

@ -25,7 +25,7 @@ func TestPlanCommand_Fails(t *testing.T) {
s := testutil.NewTestServer(t, nil) s := testutil.NewTestServer(t, nil)
defer s.Stop() defer s.Stop()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobPlanCommand{Meta: Meta{Ui: ui, flagAddress: "http://" + s.HTTPAddr}} cmd := &JobPlanCommand{Meta: Meta{Ui: ui, flagAddress: "http://" + s.HTTPAddr}}
// Fails on misuse // Fails on misuse
@ -119,7 +119,7 @@ func TestPlanCommand_From_STDIN(t *testing.T) {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobPlanCommand{ cmd := &JobPlanCommand{
Meta: Meta{Ui: ui}, Meta: Meta{Ui: ui},
JobGetter: JobGetter{testStdin: stdinR}, JobGetter: JobGetter{testStdin: stdinR},
@ -157,7 +157,7 @@ job "job1" {
func TestPlanCommand_From_URL(t *testing.T) { func TestPlanCommand_From_URL(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobPlanCommand{ cmd := &JobPlanCommand{
Meta: Meta{Ui: ui}, Meta: Meta{Ui: ui},
} }
@ -174,7 +174,7 @@ func TestPlanCommand_From_URL(t *testing.T) {
func TestPlanCommad_Preemptions(t *testing.T) { func TestPlanCommad_Preemptions(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobPlanCommand{Meta: Meta{Ui: ui}} cmd := &JobPlanCommand{Meta: Meta{Ui: ui}}
require := require.New(t) require := require.New(t)

View File

@ -17,7 +17,7 @@ func TestJobPromoteCommand_Implements(t *testing.T) {
func TestJobPromoteCommand_Fails(t *testing.T) { func TestJobPromoteCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobPromoteCommand{Meta: Meta{Ui: ui}} cmd := &JobPromoteCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -45,7 +45,7 @@ func TestJobPromoteCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobPromoteCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &JobPromoteCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake job // Create a fake job

View File

@ -17,7 +17,7 @@ func TestJobRevertCommand_Implements(t *testing.T) {
func TestJobRevertCommand_Fails(t *testing.T) { func TestJobRevertCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobRevertCommand{Meta: Meta{Ui: ui}} cmd := &JobRevertCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -45,7 +45,7 @@ func TestJobRevertCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobRevertCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &JobRevertCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake job // Create a fake job

View File

@ -17,7 +17,7 @@ func TestRunCommand_Implements(t *testing.T) {
func TestRunCommand_Output_Json(t *testing.T) { func TestRunCommand_Output_Json(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobRunCommand{Meta: Meta{Ui: ui}} cmd := &JobRunCommand{Meta: Meta{Ui: ui}}
fh, err := ioutil.TempFile("", "nomad") fh, err := ioutil.TempFile("", "nomad")
@ -58,7 +58,7 @@ func TestRunCommand_Fails(t *testing.T) {
s := testutil.NewTestServer(t, nil) s := testutil.NewTestServer(t, nil)
defer s.Stop() defer s.Stop()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobRunCommand{Meta: Meta{Ui: ui, flagAddress: "http://" + s.HTTPAddr}} cmd := &JobRunCommand{Meta: Meta{Ui: ui, flagAddress: "http://" + s.HTTPAddr}}
// Fails on misuse // Fails on misuse
@ -162,7 +162,7 @@ func TestRunCommand_From_STDIN(t *testing.T) {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobRunCommand{ cmd := &JobRunCommand{
Meta: Meta{Ui: ui}, Meta: Meta{Ui: ui},
JobGetter: JobGetter{testStdin: stdinR}, JobGetter: JobGetter{testStdin: stdinR},
@ -200,7 +200,7 @@ job "job1" {
func TestRunCommand_From_URL(t *testing.T) { func TestRunCommand_From_URL(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobRunCommand{ cmd := &JobRunCommand{
Meta: Meta{Ui: ui}, Meta: Meta{Ui: ui},
} }

View File

@ -43,7 +43,7 @@ func TestJobStatusCommand_Run(t *testing.T) {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
}) })
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobStatusCommand{Meta: Meta{Ui: ui}} cmd := &JobStatusCommand{Meta: Meta{Ui: ui}}
// Should return blank for no jobs // Should return blank for no jobs
@ -220,7 +220,7 @@ func TestJobStatusCommand_Run(t *testing.T) {
func TestJobStatusCommand_Fails(t *testing.T) { func TestJobStatusCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobStatusCommand{Meta: Meta{Ui: ui}} cmd := &JobStatusCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -248,7 +248,7 @@ func TestJobStatusCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobStatusCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &JobStatusCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake job // Create a fake job
@ -303,7 +303,7 @@ func TestJobStatusCommand_WithAccessPolicy(t *testing.T) {
invalidToken := mock.ACLToken() invalidToken := mock.ACLToken()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobStatusCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &JobStatusCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// registering a job without a token fails // registering a job without a token fails
@ -353,7 +353,7 @@ func TestJobStatusCommand_RescheduleEvals(t *testing.T) {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
}) })
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobStatusCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &JobStatusCommand{Meta: Meta{Ui: ui, flagAddress: url}}
require := require.New(t) require := require.New(t)

View File

@ -20,7 +20,7 @@ func TestStopCommand_Fails(t *testing.T) {
srv, _, url := testServer(t, false, nil) srv, _, url := testServer(t, false, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobStopCommand{Meta: Meta{Ui: ui}} cmd := &JobStopCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -57,7 +57,7 @@ func TestStopCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobStopCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &JobStopCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake job // Create a fake job

View File

@ -21,7 +21,7 @@ func TestValidateCommand(t *testing.T) {
s := testutil.NewTestServer(t, nil) s := testutil.NewTestServer(t, nil)
defer s.Stop() defer s.Stop()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobValidateCommand{Meta: Meta{Ui: ui, flagAddress: "http://" + s.HTTPAddr}} cmd := &JobValidateCommand{Meta: Meta{Ui: ui, flagAddress: "http://" + s.HTTPAddr}}
fh, err := ioutil.TempFile("", "nomad") fh, err := ioutil.TempFile("", "nomad")
@ -57,7 +57,7 @@ job "job1" {
func TestValidateCommand_Fails(t *testing.T) { func TestValidateCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobValidateCommand{Meta: Meta{Ui: ui}} cmd := &JobValidateCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -124,7 +124,7 @@ func TestValidateCommand_From_STDIN(t *testing.T) {
s := testutil.NewTestServer(t, nil) s := testutil.NewTestServer(t, nil)
defer s.Stop() defer s.Stop()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobValidateCommand{ cmd := &JobValidateCommand{
Meta: Meta{Ui: ui, flagAddress: "http://" + s.HTTPAddr}, Meta: Meta{Ui: ui, flagAddress: "http://" + s.HTTPAddr},
JobGetter: JobGetter{testStdin: stdinR}, JobGetter: JobGetter{testStdin: stdinR},
@ -161,7 +161,7 @@ job "job1" {
func TestValidateCommand_From_URL(t *testing.T) { func TestValidateCommand_From_URL(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobRunCommand{ cmd := &JobRunCommand{
Meta: Meta{Ui: ui}, Meta: Meta{Ui: ui},
} }

View File

@ -17,7 +17,7 @@ func TestCommand_LicenseGet_OSSErr(t *testing.T) {
srv, _, url := testServer(t, false, nil) srv, _, url := testServer(t, false, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &LicenseGetCommand{Meta: Meta{Ui: ui}} cmd := &LicenseGetCommand{Meta: Meta{Ui: ui}}
code := cmd.Run([]string{"-address=" + url}) code := cmd.Run([]string{"-address=" + url})
@ -47,7 +47,7 @@ func TestOutputLicenseReply(t *testing.T) {
}, },
} }
ui := new(cli.MockUi) ui := cli.NewMockUi()
require.Equal(t, 0, OutputLicenseReply(ui, lic)) require.Equal(t, 0, OutputLicenseReply(ui, lic))

View File

@ -16,7 +16,7 @@ func TestCommand_LicensePut_Err(t *testing.T) {
srv, _, url := testServer(t, false, nil) srv, _, url := testServer(t, false, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &LicensePutCommand{Meta: Meta{Ui: ui}, testStdin: strings.NewReader("testlicenseblob")} cmd := &LicensePutCommand{Meta: Meta{Ui: ui}, testStdin: strings.NewReader("testlicenseblob")}
if code := cmd.Run([]string{"-address=" + url, "-"}); code != 1 { if code := cmd.Run([]string{"-address=" + url, "-"}); code != 1 {

View File

@ -11,7 +11,7 @@ import (
func TestMonitor_Update_Eval(t *testing.T) { func TestMonitor_Update_Eval(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
mon := newMonitor(ui, nil, fullId) mon := newMonitor(ui, nil, fullId)
// Evals triggered by jobs log // Evals triggered by jobs log
@ -65,7 +65,7 @@ func TestMonitor_Update_Eval(t *testing.T) {
func TestMonitor_Update_Allocs(t *testing.T) { func TestMonitor_Update_Allocs(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
mon := newMonitor(ui, nil, fullId) mon := newMonitor(ui, nil, fullId)
// New allocations write new logs // New allocations write new logs
@ -136,7 +136,7 @@ func TestMonitor_Update_Allocs(t *testing.T) {
func TestMonitor_Update_AllocModification(t *testing.T) { func TestMonitor_Update_AllocModification(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
mon := newMonitor(ui, nil, fullId) mon := newMonitor(ui, nil, fullId)
// New allocs with a create index lower than the // New allocs with a create index lower than the
@ -176,7 +176,7 @@ func TestMonitor_Monitor(t *testing.T) {
defer srv.Shutdown() defer srv.Shutdown()
// Create the monitor // Create the monitor
ui := new(cli.MockUi) ui := cli.NewMockUi()
mon := newMonitor(ui, client, fullId) mon := newMonitor(ui, client, fullId)
// Submit a job - this creates a new evaluation we can monitor // Submit a job - this creates a new evaluation we can monitor
@ -223,7 +223,7 @@ func TestMonitor_MonitorWithPrefix(t *testing.T) {
defer srv.Shutdown() defer srv.Shutdown()
// Create the monitor // Create the monitor
ui := new(cli.MockUi) ui := cli.NewMockUi()
mon := newMonitor(ui, client, shortId) mon := newMonitor(ui, client, shortId)
// Submit a job - this creates a new evaluation we can monitor // Submit a job - this creates a new evaluation we can monitor

View File

@ -17,7 +17,7 @@ func TestNamespaceApplyCommand_Implements(t *testing.T) {
func TestNamespaceApplyCommand_Fails(t *testing.T) { func TestNamespaceApplyCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NamespaceApplyCommand{Meta: Meta{Ui: ui}} cmd := &NamespaceApplyCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -45,7 +45,7 @@ func TestNamespaceApplyCommand_Good(t *testing.T) {
srv, client, url := testServer(t, true, nil) srv, client, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NamespaceApplyCommand{Meta: Meta{Ui: ui}} cmd := &NamespaceApplyCommand{Meta: Meta{Ui: ui}}
// Create a namespace // Create a namespace

View File

@ -19,7 +19,7 @@ func TestNamespaceDeleteCommand_Implements(t *testing.T) {
func TestNamespaceDeleteCommand_Fails(t *testing.T) { func TestNamespaceDeleteCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NamespaceDeleteCommand{Meta: Meta{Ui: ui}} cmd := &NamespaceDeleteCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -47,7 +47,7 @@ func TestNamespaceDeleteCommand_Good(t *testing.T) {
srv, client, url := testServer(t, true, nil) srv, client, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NamespaceDeleteCommand{Meta: Meta{Ui: ui}} cmd := &NamespaceDeleteCommand{Meta: Meta{Ui: ui}}
// Create a namespace to delete // Create a namespace to delete
@ -74,7 +74,7 @@ func TestNamespaceDeleteCommand_AutocompleteArgs(t *testing.T) {
srv, client, url := testServer(t, true, nil) srv, client, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NamespaceDeleteCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &NamespaceDeleteCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a namespace other than default // Create a namespace other than default

View File

@ -19,7 +19,7 @@ func TestNamespaceInspectCommand_Implements(t *testing.T) {
func TestNamespaceInspectCommand_Fails(t *testing.T) { func TestNamespaceInspectCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NamespaceInspectCommand{Meta: Meta{Ui: ui}} cmd := &NamespaceInspectCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -47,7 +47,7 @@ func TestNamespaceInspectCommand_Good(t *testing.T) {
srv, client, url := testServer(t, true, nil) srv, client, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NamespaceInspectCommand{Meta: Meta{Ui: ui}} cmd := &NamespaceInspectCommand{Meta: Meta{Ui: ui}}
// Create a namespace // Create a namespace
@ -75,7 +75,7 @@ func TestNamespaceInspectCommand_AutocompleteArgs(t *testing.T) {
srv, client, url := testServer(t, true, nil) srv, client, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NamespaceInspectCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &NamespaceInspectCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a namespace // Create a namespace
@ -104,7 +104,7 @@ func TestNamespaceInspectCommand_NamespaceMatchesPrefix(t *testing.T) {
srv, client, url := testServer(t, true, nil) srv, client, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NamespaceInspectCommand{Meta: Meta{Ui: ui}} cmd := &NamespaceInspectCommand{Meta: Meta{Ui: ui}}
// Create a namespace that uses foo as a prefix // Create a namespace that uses foo as a prefix

View File

@ -16,7 +16,7 @@ func TestNamespaceListCommand_Implements(t *testing.T) {
func TestNamespaceListCommand_Fails(t *testing.T) { func TestNamespaceListCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NamespaceListCommand{Meta: Meta{Ui: ui}} cmd := &NamespaceListCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -44,7 +44,7 @@ func TestNamespaceListCommand_List(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NamespaceListCommand{Meta: Meta{Ui: ui}} cmd := &NamespaceListCommand{Meta: Meta{Ui: ui}}
// List should contain default deployment // List should contain default deployment

View File

@ -19,7 +19,7 @@ func TestNamespaceStatusCommand_Implements(t *testing.T) {
func TestNamespaceStatusCommand_Fails(t *testing.T) { func TestNamespaceStatusCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NamespaceStatusCommand{Meta: Meta{Ui: ui}} cmd := &NamespaceStatusCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -47,7 +47,7 @@ func TestNamespaceStatusCommand_Good(t *testing.T) {
srv, client, url := testServer(t, true, nil) srv, client, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NamespaceStatusCommand{Meta: Meta{Ui: ui}} cmd := &NamespaceStatusCommand{Meta: Meta{Ui: ui}}
// Create a namespace // Create a namespace
@ -76,7 +76,7 @@ func TestNamespaceStatusCommand_Good_Quota(t *testing.T) {
srv, client, url := testServer(t, true, nil) srv, client, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NamespaceStatusCommand{Meta: Meta{Ui: ui}} cmd := &NamespaceStatusCommand{Meta: Meta{Ui: ui}}
// Create a quota to delete // Create a quota to delete
@ -116,7 +116,7 @@ func TestNamespaceStatusCommand_AutocompleteArgs(t *testing.T) {
srv, client, url := testServer(t, true, nil) srv, client, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NamespaceStatusCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &NamespaceStatusCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a namespace // Create a namespace
@ -145,7 +145,7 @@ func TestNamespaceStatusCommand_NamespaceMatchesPrefix(t *testing.T) {
srv, client, url := testServer(t, true, nil) srv, client, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NamespaceStatusCommand{Meta: Meta{Ui: ui}} cmd := &NamespaceStatusCommand{Meta: Meta{Ui: ui}}
// Create a namespace that uses foo as a prefix // Create a namespace that uses foo as a prefix

View File

@ -20,7 +20,7 @@ func TestClientConfigCommand_UpdateServers(t *testing.T) {
}) })
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NodeConfigCommand{Meta: Meta{Ui: ui}} cmd := &NodeConfigCommand{Meta: Meta{Ui: ui}}
// Fails if trying to update with no servers // Fails if trying to update with no servers
@ -48,7 +48,7 @@ func TestClientConfigCommand_UpdateServers(t *testing.T) {
func TestClientConfigCommand_Fails(t *testing.T) { func TestClientConfigCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NodeConfigCommand{Meta: Meta{Ui: ui}} cmd := &NodeConfigCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse

View File

@ -80,7 +80,7 @@ func TestNodeDrainCommand_Detach(t *testing.T) {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
}) })
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NodeDrainCommand{Meta: Meta{Ui: ui}} cmd := &NodeDrainCommand{Meta: Meta{Ui: ui}}
if code := cmd.Run([]string{"-address=" + url, "-self", "-enable", "-detach"}); code != 0 { if code := cmd.Run([]string{"-address=" + url, "-self", "-enable", "-detach"}); code != 0 {
t.Fatalf("expected exit 0, got: %d", code) t.Fatalf("expected exit 0, got: %d", code)
@ -302,7 +302,7 @@ func TestNodeDrainCommand_Fails(t *testing.T) {
srv, _, url := testServer(t, false, nil) srv, _, url := testServer(t, false, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NodeDrainCommand{Meta: Meta{Ui: ui}} cmd := &NodeDrainCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -434,7 +434,7 @@ func TestNodeDrainCommand_AutocompleteArgs(t *testing.T) {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
}) })
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NodeDrainCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &NodeDrainCommand{Meta: Meta{Ui: ui, flagAddress: url}}
prefix := nodeID[:len(nodeID)-5] prefix := nodeID[:len(nodeID)-5]

View File

@ -21,7 +21,7 @@ func TestNodeEligibilityCommand_Fails(t *testing.T) {
srv, _, url := testServer(t, false, nil) srv, _, url := testServer(t, false, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NodeEligibilityCommand{Meta: Meta{Ui: ui}} cmd := &NodeEligibilityCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -112,7 +112,7 @@ func TestNodeEligibilityCommand_AutocompleteArgs(t *testing.T) {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
}) })
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NodeEligibilityCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &NodeEligibilityCommand{Meta: Meta{Ui: ui, flagAddress: url}}
prefix := nodeID[:len(nodeID)-5] prefix := nodeID[:len(nodeID)-5]

View File

@ -27,7 +27,7 @@ func TestNodeStatusCommand_Self(t *testing.T) {
}) })
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NodeStatusCommand{Meta: Meta{Ui: ui}} cmd := &NodeStatusCommand{Meta: Meta{Ui: ui}}
// Wait for a node to appear // Wait for a node to appear
@ -78,7 +78,7 @@ func TestNodeStatusCommand_Run(t *testing.T) {
}) })
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NodeStatusCommand{Meta: Meta{Ui: ui}} cmd := &NodeStatusCommand{Meta: Meta{Ui: ui}}
// Wait for a node to appear // Wait for a node to appear
@ -167,7 +167,7 @@ func TestNodeStatusCommand_Fails(t *testing.T) {
srv, _, url := testServer(t, false, nil) srv, _, url := testServer(t, false, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NodeStatusCommand{Meta: Meta{Ui: ui}} cmd := &NodeStatusCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -238,7 +238,7 @@ func TestNodeStatusCommand_AutocompleteArgs(t *testing.T) {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
}) })
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &NodeStatusCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &NodeStatusCommand{Meta: Meta{Ui: ui, flagAddress: url}}
prefix := nodeID[:len(nodeID)-5] prefix := nodeID[:len(nodeID)-5]

View File

@ -17,7 +17,7 @@ func TestOperatorAutopilotGetConfigCommand(t *testing.T) {
s, _, addr := testServer(t, false, nil) s, _, addr := testServer(t, false, nil)
defer s.Shutdown() defer s.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
c := &OperatorAutopilotGetCommand{Meta: Meta{Ui: ui}} c := &OperatorAutopilotGetCommand{Meta: Meta{Ui: ui}}
args := []string{"-address=" + addr} args := []string{"-address=" + addr}

View File

@ -20,7 +20,7 @@ func TestOperatorAutopilotSetConfigCommand(t *testing.T) {
s, _, addr := testServer(t, false, nil) s, _, addr := testServer(t, false, nil)
defer s.Shutdown() defer s.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
c := &OperatorAutopilotSetCommand{Meta: Meta{Ui: ui}} c := &OperatorAutopilotSetCommand{Meta: Meta{Ui: ui}}
args := []string{ args := []string{
"-address=" + addr, "-address=" + addr,

View File

@ -37,7 +37,7 @@ func TestDebugFails(t *testing.T) {
srv, _, _ := testServer(t, false, nil) srv, _, _ := testServer(t, false, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &OperatorDebugCommand{Meta: Meta{Ui: ui}} cmd := &OperatorDebugCommand{Meta: Meta{Ui: ui}}
// Fails incorrect args // Fails incorrect args
@ -75,7 +75,7 @@ func TestDebugCapturedFiles(t *testing.T) {
srv, _, url := testServer(t, false, nil) srv, _, url := testServer(t, false, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &OperatorDebugCommand{Meta: Meta{Ui: ui}} cmd := &OperatorDebugCommand{Meta: Meta{Ui: ui}}
code := cmd.Run([]string{ code := cmd.Run([]string{

View File

@ -9,7 +9,7 @@ import (
func TestKeygenCommand(t *testing.T) { func TestKeygenCommand(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
c := &OperatorKeygenCommand{Meta: Meta{Ui: ui}} c := &OperatorKeygenCommand{Meta: Meta{Ui: ui}}
code := c.Run(nil) code := c.Run(nil)
if code != 0 { if code != 0 {

View File

@ -17,7 +17,7 @@ func TestOperator_Raft_ListPeers(t *testing.T) {
s, _, addr := testServer(t, false, nil) s, _, addr := testServer(t, false, nil)
defer s.Shutdown() defer s.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
c := &OperatorRaftListCommand{Meta: Meta{Ui: ui}} c := &OperatorRaftListCommand{Meta: Meta{Ui: ui}}
args := []string{"-address=" + addr} args := []string{"-address=" + addr}

View File

@ -18,7 +18,7 @@ func TestOperator_Raft_RemovePeer(t *testing.T) {
s, _, addr := testServer(t, false, nil) s, _, addr := testServer(t, false, nil)
defer s.Shutdown() defer s.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
c := &OperatorRaftRemoveCommand{Meta: Meta{Ui: ui}} c := &OperatorRaftRemoveCommand{Meta: Meta{Ui: ui}}
args := []string{"-address=" + addr, "-peer-address=nope", "-peer-id=nope"} args := []string{"-address=" + addr, "-peer-address=nope", "-peer-id=nope"}
@ -46,7 +46,7 @@ func TestOperator_Raft_RemovePeerAddress(t *testing.T) {
s, _, addr := testServer(t, false, nil) s, _, addr := testServer(t, false, nil)
defer s.Shutdown() defer s.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
c := &OperatorRaftRemoveCommand{Meta: Meta{Ui: ui}} c := &OperatorRaftRemoveCommand{Meta: Meta{Ui: ui}}
args := []string{"-address=" + addr, "-peer-address=nope"} args := []string{"-address=" + addr, "-peer-address=nope"}
@ -65,7 +65,7 @@ func TestOperator_Raft_RemovePeerID(t *testing.T) {
s, _, addr := testServer(t, false, nil) s, _, addr := testServer(t, false, nil)
defer s.Shutdown() defer s.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
c := &OperatorRaftRemoveCommand{Meta: Meta{Ui: ui}} c := &OperatorRaftRemoveCommand{Meta: Meta{Ui: ui}}
args := []string{"-address=" + addr, "-peer-id=nope"} args := []string{"-address=" + addr, "-peer-id=nope"}

View File

@ -17,7 +17,7 @@ func TestOperatorSnapshotInspect_Works(t *testing.T) {
snapPath := generateSnapshotFile(t, nil) snapPath := generateSnapshotFile(t, nil)
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &OperatorSnapshotInspectCommand{Meta: Meta{Ui: ui}} cmd := &OperatorSnapshotInspectCommand{Meta: Meta{Ui: ui}}
code := cmd.Run([]string{snapPath}) code := cmd.Run([]string{snapPath})
@ -49,7 +49,7 @@ func TestOperatorSnapshotInspect_HandlesFailure(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
t.Run("not found", func(t *testing.T) { t.Run("not found", func(t *testing.T) {
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &OperatorSnapshotInspectCommand{Meta: Meta{Ui: ui}} cmd := &OperatorSnapshotInspectCommand{Meta: Meta{Ui: ui}}
code := cmd.Run([]string{filepath.Join(tmpDir, "foo")}) code := cmd.Run([]string{filepath.Join(tmpDir, "foo")})
@ -58,7 +58,7 @@ func TestOperatorSnapshotInspect_HandlesFailure(t *testing.T) {
}) })
t.Run("invalid file", func(t *testing.T) { t.Run("invalid file", func(t *testing.T) {
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &OperatorSnapshotInspectCommand{Meta: Meta{Ui: ui}} cmd := &OperatorSnapshotInspectCommand{Meta: Meta{Ui: ui}}
code := cmd.Run([]string{filepath.Join(tmpDir, "invalid.snap")}) code := cmd.Run([]string{filepath.Join(tmpDir, "invalid.snap")})
@ -90,7 +90,7 @@ func generateSnapshotFile(t *testing.T, prepare func(srv *agent.TestAgent, clien
prepare(srv, api, url) prepare(srv, api, url)
} }
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &OperatorSnapshotSaveCommand{Meta: Meta{Ui: ui}} cmd := &OperatorSnapshotSaveCommand{Meta: Meta{Ui: ui}}
dest := filepath.Join(tmpDir, "backup.snap") dest := filepath.Join(tmpDir, "backup.snap")

View File

@ -39,7 +39,7 @@ job "snapshot-test-job" {
}` }`
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &JobRunCommand{Meta: Meta{Ui: ui}} cmd := &JobRunCommand{Meta: Meta{Ui: ui}}
cmd.JobGetter.testStdin = strings.NewReader(sampleJob) cmd.JobGetter.testStdin = strings.NewReader(sampleJob)
@ -63,7 +63,7 @@ job "snapshot-test-job" {
require.NoError(t, err) require.NoError(t, err)
require.Nil(t, j) require.Nil(t, j)
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &OperatorSnapshotRestoreCommand{Meta: Meta{Ui: ui}} cmd := &OperatorSnapshotRestoreCommand{Meta: Meta{Ui: ui}}
code := cmd.Run([]string{"--address=" + url, snapshotPath}) code := cmd.Run([]string{"--address=" + url, snapshotPath})
@ -79,7 +79,7 @@ job "snapshot-test-job" {
func TestOperatorSnapshotRestore_Fails(t *testing.T) { func TestOperatorSnapshotRestore_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &OperatorSnapshotRestoreCommand{Meta: Meta{Ui: ui}} cmd := &OperatorSnapshotRestoreCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse

View File

@ -31,7 +31,7 @@ func TestOperatorSnapshotSave_Works(t *testing.T) {
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &OperatorSnapshotSaveCommand{Meta: Meta{Ui: ui}} cmd := &OperatorSnapshotSaveCommand{Meta: Meta{Ui: ui}}
dest := filepath.Join(tmpDir, "backup.snap") dest := filepath.Join(tmpDir, "backup.snap")
@ -53,7 +53,7 @@ func TestOperatorSnapshotSave_Works(t *testing.T) {
func TestOperatorSnapshotSave_Fails(t *testing.T) { func TestOperatorSnapshotSave_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &OperatorSnapshotSaveCommand{Meta: Meta{Ui: ui}} cmd := &OperatorSnapshotSaveCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse

View File

@ -17,7 +17,7 @@ func TestPluginStatusCommand_Implements(t *testing.T) {
func TestPluginStatusCommand_Fails(t *testing.T) { func TestPluginStatusCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &PluginStatusCommand{Meta: Meta{Ui: ui}} cmd := &PluginStatusCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -35,7 +35,7 @@ func TestPluginStatusCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &PluginStatusCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &PluginStatusCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a plugin // Create a plugin

View File

@ -14,7 +14,7 @@ func TestQuotaApplyCommand_Implements(t *testing.T) {
func TestQuotaApplyCommand_Fails(t *testing.T) { func TestQuotaApplyCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &QuotaApplyCommand{Meta: Meta{Ui: ui}} cmd := &QuotaApplyCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse

View File

@ -20,7 +20,7 @@ func TestQuotaDeleteCommand_Implements(t *testing.T) {
func TestQuotaDeleteCommand_Fails(t *testing.T) { func TestQuotaDeleteCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &QuotaDeleteCommand{Meta: Meta{Ui: ui}} cmd := &QuotaDeleteCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -48,7 +48,7 @@ func TestQuotaDeleteCommand_Good(t *testing.T) {
srv, client, url := testServer(t, true, nil) srv, client, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &QuotaDeleteCommand{Meta: Meta{Ui: ui}} cmd := &QuotaDeleteCommand{Meta: Meta{Ui: ui}}
// Create a quota to delete // Create a quota to delete
@ -73,7 +73,7 @@ func TestQuotaDeleteCommand_AutocompleteArgs(t *testing.T) {
srv, client, url := testServer(t, true, nil) srv, client, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &QuotaDeleteCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &QuotaDeleteCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a quota // Create a quota

View File

@ -16,7 +16,7 @@ func TestQuotaInitCommand_Implements(t *testing.T) {
func TestQuotaInitCommand_Run_HCL(t *testing.T) { func TestQuotaInitCommand_Run_HCL(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &QuotaInitCommand{Meta: Meta{Ui: ui}} cmd := &QuotaInitCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -68,7 +68,7 @@ func TestQuotaInitCommand_Run_HCL(t *testing.T) {
func TestQuotaInitCommand_Run_JSON(t *testing.T) { func TestQuotaInitCommand_Run_JSON(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &QuotaInitCommand{Meta: Meta{Ui: ui}} cmd := &QuotaInitCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse

View File

@ -18,7 +18,7 @@ func TestQuotaInspectCommand_Implements(t *testing.T) {
func TestQuotaInspectCommand_Fails(t *testing.T) { func TestQuotaInspectCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &QuotaInspectCommand{Meta: Meta{Ui: ui}} cmd := &QuotaInspectCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -46,7 +46,7 @@ func TestQuotaInspectCommand_Good(t *testing.T) {
srv, client, url := testServer(t, true, nil) srv, client, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &QuotaInspectCommand{Meta: Meta{Ui: ui}} cmd := &QuotaInspectCommand{Meta: Meta{Ui: ui}}
// Create a quota to delete // Create a quota to delete
@ -72,7 +72,7 @@ func TestQuotaInspectCommand_AutocompleteArgs(t *testing.T) {
srv, client, url := testServer(t, true, nil) srv, client, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &QuotaInspectCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &QuotaInspectCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a quota // Create a quota

View File

@ -17,7 +17,7 @@ func TestQuotaListCommand_Implements(t *testing.T) {
func TestQuotaListCommand_Fails(t *testing.T) { func TestQuotaListCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &QuotaListCommand{Meta: Meta{Ui: ui}} cmd := &QuotaListCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -46,7 +46,7 @@ func TestQuotaListCommand_List(t *testing.T) {
srv, client, url := testServer(t, true, nil) srv, client, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &QuotaListCommand{Meta: Meta{Ui: ui}} cmd := &QuotaListCommand{Meta: Meta{Ui: ui}}
// Create a quota // Create a quota

View File

@ -18,7 +18,7 @@ func TestQuotaStatusCommand_Implements(t *testing.T) {
func TestQuotaStatusCommand_Fails(t *testing.T) { func TestQuotaStatusCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &QuotaStatusCommand{Meta: Meta{Ui: ui}} cmd := &QuotaStatusCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -46,7 +46,7 @@ func TestQuotaStatusCommand_Good(t *testing.T) {
srv, client, url := testServer(t, true, nil) srv, client, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &QuotaStatusCommand{Meta: Meta{Ui: ui}} cmd := &QuotaStatusCommand{Meta: Meta{Ui: ui}}
// Create a quota to delete // Create a quota to delete
@ -78,7 +78,7 @@ func TestQuotaStatusCommand_AutocompleteArgs(t *testing.T) {
srv, client, url := testServer(t, true, nil) srv, client, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &QuotaStatusCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &QuotaStatusCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a quota // Create a quota

View File

@ -19,7 +19,7 @@ func TestServerMembersCommand_Run(t *testing.T) {
srv, client, url := testServer(t, false, nil) srv, client, url := testServer(t, false, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &ServerMembersCommand{Meta: Meta{Ui: ui}} cmd := &ServerMembersCommand{Meta: Meta{Ui: ui}}
// Get our own node name // Get our own node name
@ -48,7 +48,7 @@ func TestServerMembersCommand_Run(t *testing.T) {
func TestMembersCommand_Fails(t *testing.T) { func TestMembersCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &ServerMembersCommand{Meta: Meta{Ui: ui}} cmd := &ServerMembersCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -97,7 +97,7 @@ func TestServerMembersCommand_MultiRegion_Leave(t *testing.T) {
if _, err := srv2.Agent.Server().Join([]string{addr}); err != nil { if _, err := srv2.Agent.Server().Join([]string{addr}); err != nil {
t.Fatalf("Join err: %v", err) t.Fatalf("Join err: %v", err)
} }
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &ServerMembersCommand{Meta: Meta{Ui: ui}} cmd := &ServerMembersCommand{Meta: Meta{Ui: ui}}
// Get our own node name // Get our own node name

View File

@ -20,7 +20,7 @@ func TestStatusCommand_Run_JobStatus(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &StatusCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &StatusCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake job // Create a fake job
@ -46,7 +46,7 @@ func TestStatusCommand_Run_JobStatus_MultiMatch(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &StatusCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &StatusCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create two fake jobs sharing a prefix // Create two fake jobs sharing a prefix
@ -75,7 +75,7 @@ func TestStatusCommand_Run_EvalStatus(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &StatusCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &StatusCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake eval // Create a fake eval
@ -104,7 +104,7 @@ func TestStatusCommand_Run_NodeStatus(t *testing.T) {
}) })
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &StatusCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &StatusCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Wait for a node to appear // Wait for a node to appear
@ -141,7 +141,7 @@ func TestStatusCommand_Run_AllocStatus(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &StatusCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &StatusCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake alloc // Create a fake alloc
@ -166,7 +166,7 @@ func TestStatusCommand_Run_DeploymentStatus(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &StatusCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &StatusCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake deployment // Create a fake deployment
@ -192,7 +192,7 @@ func TestStatusCommand_Run_NoPrefix(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &StatusCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &StatusCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake job // Create a fake job
@ -218,7 +218,7 @@ func TestStatusCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &StatusCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &StatusCommand{Meta: Meta{Ui: ui, flagAddress: url}}
// Create a fake job // Create a fake job

View File

@ -18,7 +18,7 @@ func TestSystemGCCommand_Good(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &SystemGCCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &SystemGCCommand{Meta: Meta{Ui: ui, flagAddress: url}}
if code := cmd.Run([]string{"-address=" + url}); code != 0 { if code := cmd.Run([]string{"-address=" + url}); code != 0 {

View File

@ -18,7 +18,7 @@ func TestSystemReconcileSummariesCommand_Good(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &SystemReconcileSummariesCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &SystemReconcileSummariesCommand{Meta: Meta{Ui: ui, flagAddress: url}}
if code := cmd.Run([]string{"-address=" + url}); code != 0 { if code := cmd.Run([]string{"-address=" + url}); code != 0 {

View File

@ -17,7 +17,7 @@ func TestCSIVolumeStatusCommand_Implements(t *testing.T) {
func TestCSIVolumeStatusCommand_Fails(t *testing.T) { func TestCSIVolumeStatusCommand_Fails(t *testing.T) {
t.Parallel() t.Parallel()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &VolumeStatusCommand{Meta: Meta{Ui: ui}} cmd := &VolumeStatusCommand{Meta: Meta{Ui: ui}}
// Fails on misuse // Fails on misuse
@ -35,7 +35,7 @@ func TestCSIVolumeStatusCommand_AutocompleteArgs(t *testing.T) {
srv, _, url := testServer(t, true, nil) srv, _, url := testServer(t, true, nil)
defer srv.Shutdown() defer srv.Shutdown()
ui := new(cli.MockUi) ui := cli.NewMockUi()
cmd := &VolumeStatusCommand{Meta: Meta{Ui: ui, flagAddress: url}} cmd := &VolumeStatusCommand{Meta: Meta{Ui: ui, flagAddress: url}}
state := srv.Agent.Server().State() state := srv.Agent.Server().State()