test: run command tests in parallel

This commit is contained in:
Frank Schroeder 2017-05-22 20:18:53 +02:00
parent 3658d4d428
commit 9509ab463c
No known key found for this signature in database
GPG Key ID: 4D65C6EAEC87DECD
34 changed files with 131 additions and 0 deletions

View File

@ -22,10 +22,12 @@ func testConfigTestCommand(t *testing.T) (*cli.MockUi, *ConfigTestCommand) {
}
func TestConfigTestCommand_implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &ConfigTestCommand{}
}
func TestConfigTestCommandFailOnEmptyFile(t *testing.T) {
t.Parallel()
tmpFile := testutil.TempFile(t, "consul")
defer os.RemoveAll(tmpFile.Name())
@ -41,6 +43,7 @@ func TestConfigTestCommandFailOnEmptyFile(t *testing.T) {
}
func TestConfigTestCommandSucceedOnEmptyDir(t *testing.T) {
t.Parallel()
td := testutil.TempDir(t, "consul")
defer os.RemoveAll(td)
@ -56,6 +59,7 @@ func TestConfigTestCommandSucceedOnEmptyDir(t *testing.T) {
}
func TestConfigTestCommandSucceedOnMinimalConfigFile(t *testing.T) {
t.Parallel()
td := testutil.TempDir(t, "consul")
defer os.RemoveAll(td)
@ -77,6 +81,7 @@ func TestConfigTestCommandSucceedOnMinimalConfigFile(t *testing.T) {
}
func TestConfigTestCommandSucceedOnMinimalConfigDir(t *testing.T) {
t.Parallel()
td := testutil.TempDir(t, "consul")
defer os.RemoveAll(td)
@ -97,6 +102,7 @@ func TestConfigTestCommandSucceedOnMinimalConfigDir(t *testing.T) {
}
func TestConfigTestCommandSucceedOnConfigDirWithEmptyFile(t *testing.T) {
t.Parallel()
td := testutil.TempDir(t, "consul")
defer os.RemoveAll(td)

View File

@ -10,10 +10,12 @@ import (
)
func TestEventCommand_implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &EventCommand{}
}
func TestEventCommandRun(t *testing.T) {
t.Parallel()
a1 := agent.NewTestAgent(t.Name(), nil)
defer a1.Shutdown()

View File

@ -24,10 +24,12 @@ func testExecCommand(t *testing.T) (*cli.MockUi, *ExecCommand) {
}
func TestExecCommand_implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &ExecCommand{}
}
func TestExecCommandRun(t *testing.T) {
t.Parallel()
cfg := agent.TestConfig()
cfg.DisableRemoteExec = agent.Bool(false)
a := agent.NewTestAgent(t.Name(), cfg)
@ -47,6 +49,7 @@ func TestExecCommandRun(t *testing.T) {
}
func TestExecCommandRun_CrossDC(t *testing.T) {
t.Parallel()
cfg1 := agent.TestConfig()
cfg1.DisableRemoteExec = agent.Bool(false)
a1 := agent.NewTestAgent(t.Name(), cfg1)
@ -82,6 +85,7 @@ func TestExecCommandRun_CrossDC(t *testing.T) {
}
func TestExecCommand_Validate(t *testing.T) {
t.Parallel()
conf := &rExecConf{}
err := conf.validate()
if err != nil {
@ -117,6 +121,7 @@ func TestExecCommand_Validate(t *testing.T) {
}
func TestExecCommand_Sessions(t *testing.T) {
t.Parallel()
cfg := agent.TestConfig()
cfg.DisableRemoteExec = agent.Bool(false)
a := agent.NewTestAgent(t.Name(), cfg)
@ -155,6 +160,7 @@ func TestExecCommand_Sessions(t *testing.T) {
}
func TestExecCommand_Sessions_Foreign(t *testing.T) {
t.Parallel()
cfg := agent.TestConfig()
cfg.DisableRemoteExec = agent.Bool(false)
a := agent.NewTestAgent(t.Name(), cfg)
@ -204,6 +210,7 @@ func TestExecCommand_Sessions_Foreign(t *testing.T) {
}
func TestExecCommand_UploadDestroy(t *testing.T) {
t.Parallel()
cfg := agent.TestConfig()
cfg.DisableRemoteExec = agent.Bool(false)
a := agent.NewTestAgent(t.Name(), cfg)
@ -258,6 +265,7 @@ func TestExecCommand_UploadDestroy(t *testing.T) {
}
func TestExecCommand_StreamResults(t *testing.T) {
t.Parallel()
cfg := agent.TestConfig()
cfg.DisableRemoteExec = agent.Bool(false)
a := agent.NewTestAgent(t.Name(), cfg)

View File

@ -23,10 +23,12 @@ func testForceLeaveCommand(t *testing.T) (*cli.MockUi, *ForceLeaveCommand) {
}
func TestForceLeaveCommand_implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &ForceLeaveCommand{}
}
func TestForceLeaveCommandRun(t *testing.T) {
t.Parallel()
a1 := agent.NewTestAgent(t.Name(), nil)
a2 := agent.NewTestAgent(t.Name(), nil)
defer a1.Shutdown()
@ -65,6 +67,7 @@ func TestForceLeaveCommandRun(t *testing.T) {
}
func TestForceLeaveCommandRun_noAddrs(t *testing.T) {
t.Parallel()
ui := new(cli.MockUi)
ui, c := testForceLeaveCommand(t)
args := []string{"-http-addr=foo"}

View File

@ -10,10 +10,12 @@ import (
)
func TestInfoCommand_implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &InfoCommand{}
}
func TestInfoCommandRun(t *testing.T) {
t.Parallel()
a1 := agent.NewTestAgent(t.Name(), nil)
defer a1.Shutdown()

View File

@ -21,10 +21,12 @@ func testJoinCommand(t *testing.T) (*cli.MockUi, *JoinCommand) {
}
func TestJoinCommand_implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &JoinCommand{}
}
func TestJoinCommandRun(t *testing.T) {
t.Parallel()
a1 := agent.NewTestAgent(t.Name(), nil)
a2 := agent.NewTestAgent(t.Name(), nil)
defer a1.Shutdown()
@ -47,6 +49,7 @@ func TestJoinCommandRun(t *testing.T) {
}
func TestJoinCommandRun_wan(t *testing.T) {
t.Parallel()
a1 := agent.NewTestAgent(t.Name(), nil)
a2 := agent.NewTestAgent(t.Name(), nil)
defer a1.Shutdown()
@ -70,6 +73,7 @@ func TestJoinCommandRun_wan(t *testing.T) {
}
func TestJoinCommandRun_noAddrs(t *testing.T) {
t.Parallel()
ui, c := testJoinCommand(t)
args := []string{"-http-addr=foo"}

View File

@ -9,10 +9,12 @@ import (
)
func TestKeygenCommand_implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &KeygenCommand{}
}
func TestKeygenCommand(t *testing.T) {
t.Parallel()
ui := new(cli.MockUi)
c := &KeygenCommand{
Command: base.Command{

View File

@ -20,10 +20,12 @@ func testKeyringCommand(t *testing.T) (*cli.MockUi, *KeyringCommand) {
}
func TestKeyringCommand_implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &KeyringCommand{}
}
func TestKeyringCommandRun(t *testing.T) {
t.Parallel()
key1 := "HS5lJ+XuTlYKWaeGYyG+/A=="
key2 := "kZyFABeAmc64UMTrm9XuKA=="
@ -74,6 +76,7 @@ func TestKeyringCommandRun(t *testing.T) {
}
func TestKeyringCommandRun_help(t *testing.T) {
t.Parallel()
ui, c := testKeyringCommand(t)
code := c.Run(nil)
if code != 1 {
@ -87,6 +90,7 @@ func TestKeyringCommandRun_help(t *testing.T) {
}
func TestKeyringCommandRun_failedConnection(t *testing.T) {
t.Parallel()
ui, c := testKeyringCommand(t)
args := []string{"-list", "-http-addr=127.0.0.1:0"}
code := c.Run(args)
@ -99,6 +103,7 @@ func TestKeyringCommandRun_failedConnection(t *testing.T) {
}
func TestKeyringCommandRun_invalidRelayFactor(t *testing.T) {
t.Parallel()
ui, c := testKeyringCommand(t)
args := []string{"-list", "-relay-factor=6"}

View File

@ -7,9 +7,11 @@ import (
)
func TestKVCommand_implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &KVCommand{}
}
func TestKVCommand_noTabs(t *testing.T) {
t.Parallel()
assertNoTabs(t, new(KVCommand))
}

View File

@ -22,14 +22,17 @@ func testKVDeleteCommand(t *testing.T) (*cli.MockUi, *KVDeleteCommand) {
}
func TestKVDeleteCommand_implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &KVDeleteCommand{}
}
func TestKVDeleteCommand_noTabs(t *testing.T) {
t.Parallel()
assertNoTabs(t, new(KVDeleteCommand))
}
func TestKVDeleteCommand_Validation(t *testing.T) {
t.Parallel()
ui, c := testKVDeleteCommand(t)
cases := map[string]struct {
@ -80,6 +83,7 @@ func TestKVDeleteCommand_Validation(t *testing.T) {
}
func TestKVDeleteCommand_Run(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
client := a.Client()
@ -115,6 +119,7 @@ func TestKVDeleteCommand_Run(t *testing.T) {
}
func TestKVDeleteCommand_Recurse(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
client := a.Client()
@ -157,6 +162,7 @@ func TestKVDeleteCommand_Recurse(t *testing.T) {
}
func TestKVDeleteCommand_CAS(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
client := a.Client()

View File

@ -12,6 +12,7 @@ import (
)
func TestKVExportCommand_Run(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
client := a.Client()

View File

@ -22,14 +22,17 @@ func testKVGetCommand(t *testing.T) (*cli.MockUi, *KVGetCommand) {
}
func TestKVGetCommand_implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &KVGetCommand{}
}
func TestKVGetCommand_noTabs(t *testing.T) {
t.Parallel()
assertNoTabs(t, new(KVGetCommand))
}
func TestKVGetCommand_Validation(t *testing.T) {
t.Parallel()
ui, c := testKVGetCommand(t)
cases := map[string]struct {
@ -68,6 +71,7 @@ func TestKVGetCommand_Validation(t *testing.T) {
}
func TestKVGetCommand_Run(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
client := a.Client()
@ -100,6 +104,7 @@ func TestKVGetCommand_Run(t *testing.T) {
}
func TestKVGetCommand_Missing(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
@ -117,6 +122,7 @@ func TestKVGetCommand_Missing(t *testing.T) {
}
func TestKVGetCommand_Empty(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
client := a.Client()
@ -144,6 +150,7 @@ func TestKVGetCommand_Empty(t *testing.T) {
}
func TestKVGetCommand_Detailed(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
client := a.Client()
@ -186,6 +193,7 @@ func TestKVGetCommand_Detailed(t *testing.T) {
}
func TestKVGetCommand_Keys(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
client := a.Client()
@ -219,6 +227,7 @@ func TestKVGetCommand_Keys(t *testing.T) {
}
func TestKVGetCommand_Recurse(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
client := a.Client()
@ -257,6 +266,7 @@ func TestKVGetCommand_Recurse(t *testing.T) {
}
func TestKVGetCommand_RecurseBase64(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
client := a.Client()
@ -296,6 +306,7 @@ func TestKVGetCommand_RecurseBase64(t *testing.T) {
}
func TestKVGetCommand_DetailedBase64(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
client := a.Client()

View File

@ -10,6 +10,7 @@ import (
)
func TestKVImportCommand_Run(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
client := a.Client()

View File

@ -27,14 +27,17 @@ func testKVPutCommand(t *testing.T) (*cli.MockUi, *KVPutCommand) {
}
func TestKVPutCommand_implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &KVPutCommand{}
}
func TestKVPutCommand_noTabs(t *testing.T) {
t.Parallel()
assertNoTabs(t, new(KVDeleteCommand))
}
func TestKVPutCommand_Validation(t *testing.T) {
t.Parallel()
ui, c := testKVPutCommand(t)
cases := map[string]struct {
@ -85,6 +88,7 @@ func TestKVPutCommand_Validation(t *testing.T) {
}
func TestKVPutCommand_Run(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
client := a.Client()
@ -112,6 +116,7 @@ func TestKVPutCommand_Run(t *testing.T) {
}
func TestKVPutCommand_RunEmptyDataQuoted(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
client := a.Client()
@ -139,6 +144,7 @@ func TestKVPutCommand_RunEmptyDataQuoted(t *testing.T) {
}
func TestKVPutCommand_RunBase64(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
client := a.Client()
@ -174,6 +180,7 @@ func TestKVPutCommand_RunBase64(t *testing.T) {
}
func TestKVPutCommand_File(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
client := a.Client()
@ -207,6 +214,7 @@ func TestKVPutCommand_File(t *testing.T) {
}
func TestKVPutCommand_FileNoExist(t *testing.T) {
t.Parallel()
ui, c := testKVPutCommand(t)
args := []string{
@ -225,6 +233,7 @@ func TestKVPutCommand_FileNoExist(t *testing.T) {
}
func TestKVPutCommand_Stdin(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
client := a.Client()
@ -260,6 +269,7 @@ func TestKVPutCommand_Stdin(t *testing.T) {
}
func TestKVPutCommand_NegativeVal(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
client := a.Client()
@ -287,6 +297,7 @@ func TestKVPutCommand_NegativeVal(t *testing.T) {
}
func TestKVPutCommand_Flags(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
client := a.Client()
@ -315,6 +326,7 @@ func TestKVPutCommand_Flags(t *testing.T) {
}
func TestKVPutCommand_CAS(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
client := a.Client()

View File

@ -20,10 +20,12 @@ func testLeaveCommand(t *testing.T) (*cli.MockUi, *LeaveCommand) {
}
func TestLeaveCommand_implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &LeaveCommand{}
}
func TestLeaveCommandRun(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
@ -41,6 +43,7 @@ func TestLeaveCommandRun(t *testing.T) {
}
func TestLeaveCommandFailOnNonFlagArgs(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()

View File

@ -25,6 +25,7 @@ func testLockCommand(t *testing.T) (*cli.MockUi, *LockCommand) {
}
func TestLockCommand_implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &LockCommand{}
}
@ -40,12 +41,14 @@ func argFail(t *testing.T, args []string, expected string) {
}
func TestLockCommand_BadArgs(t *testing.T) {
t.Parallel()
argFail(t, []string{"-try=blah", "test/prefix", "date"}, "invalid duration")
argFail(t, []string{"-try=-10s", "test/prefix", "date"}, "Timeout must be positive")
argFail(t, []string{"-monitor-retry=-5", "test/prefix", "date"}, "must be >= 0")
}
func TestLockCommand_Run(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
@ -67,6 +70,7 @@ func TestLockCommand_Run(t *testing.T) {
}
func TestLockCommand_Try_Lock(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
@ -97,6 +101,7 @@ func TestLockCommand_Try_Lock(t *testing.T) {
}
func TestLockCommand_Try_Semaphore(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
@ -127,6 +132,7 @@ func TestLockCommand_Try_Semaphore(t *testing.T) {
}
func TestLockCommand_MonitorRetry_Lock_Default(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
@ -158,6 +164,7 @@ func TestLockCommand_MonitorRetry_Lock_Default(t *testing.T) {
}
func TestLockCommand_MonitorRetry_Semaphore_Default(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
@ -189,6 +196,7 @@ func TestLockCommand_MonitorRetry_Semaphore_Default(t *testing.T) {
}
func TestLockCommand_MonitorRetry_Lock_Arg(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
@ -220,6 +228,7 @@ func TestLockCommand_MonitorRetry_Lock_Arg(t *testing.T) {
}
func TestLockCommand_MonitorRetry_Semaphore_Arg(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()

View File

@ -21,10 +21,12 @@ func testMaintCommand(t *testing.T) (*cli.MockUi, *MaintCommand) {
}
func TestMaintCommand_implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &MaintCommand{}
}
func TestMaintCommandRun_ConflictingArgs(t *testing.T) {
t.Parallel()
_, c := testMaintCommand(t)
if code := c.Run([]string{"-enable", "-disable"}); code != 1 {
@ -45,6 +47,7 @@ func TestMaintCommandRun_ConflictingArgs(t *testing.T) {
}
func TestMaintCommandRun_NoArgs(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
@ -91,6 +94,7 @@ func TestMaintCommandRun_NoArgs(t *testing.T) {
}
func TestMaintCommandRun_EnableNodeMaintenance(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
@ -112,6 +116,7 @@ func TestMaintCommandRun_EnableNodeMaintenance(t *testing.T) {
}
func TestMaintCommandRun_DisableNodeMaintenance(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
@ -132,6 +137,7 @@ func TestMaintCommandRun_DisableNodeMaintenance(t *testing.T) {
}
func TestMaintCommandRun_EnableServiceMaintenance(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
@ -163,6 +169,7 @@ func TestMaintCommandRun_EnableServiceMaintenance(t *testing.T) {
}
func TestMaintCommandRun_DisableServiceMaintenance(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
@ -193,6 +200,7 @@ func TestMaintCommandRun_DisableServiceMaintenance(t *testing.T) {
}
func TestMaintCommandRun_ServiceMaintenance_NoService(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()

View File

@ -21,10 +21,12 @@ func testMembersCommand(t *testing.T) (*cli.MockUi, *MembersCommand) {
}
func TestMembersCommand_implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &MembersCommand{}
}
func TestMembersCommandRun(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
@ -53,6 +55,7 @@ func TestMembersCommandRun(t *testing.T) {
}
func TestMembersCommandRun_WAN(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
@ -70,6 +73,7 @@ func TestMembersCommandRun_WAN(t *testing.T) {
}
func TestMembersCommandRun_statusFilter(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
@ -90,6 +94,7 @@ func TestMembersCommandRun_statusFilter(t *testing.T) {
}
func TestMembersCommandRun_statusFilter_failed(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()

View File

@ -10,10 +10,12 @@ import (
)
func TestOperator_Autopilot_Get_Implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &OperatorAutopilotGetCommand{}
}
func TestOperator_Autopilot_Get(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()

View File

@ -12,10 +12,12 @@ import (
)
func TestOperator_Autopilot_Set_Implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &OperatorAutopilotSetCommand{}
}
func TestOperator_Autopilot_Set(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()

View File

@ -7,5 +7,6 @@ import (
)
func TestOperator_Autopilot_Implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &OperatorAutopilotCommand{}
}

View File

@ -11,10 +11,12 @@ import (
)
func TestOperator_Raft_ListPeers_Implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &OperatorRaftListCommand{}
}
func TestOperator_Raft_ListPeers(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()

View File

@ -10,10 +10,12 @@ import (
)
func TestOperator_Raft_RemovePeer_Implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &OperatorRaftRemoveCommand{}
}
func TestOperator_Raft_RemovePeer(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()

View File

@ -18,5 +18,6 @@ func testOperatorRaftCommand(t *testing.T) (*cli.MockUi, *OperatorRaftCommand) {
}
func TestOperator_Raft_Implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &OperatorRaftCommand{}
}

View File

@ -7,5 +7,6 @@ import (
)
func TestOperator_Implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &OperatorCommand{}
}

View File

@ -10,10 +10,12 @@ import (
)
func TestReloadCommand_implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &ReloadCommand{}
}
func TestReloadCommandRun(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()

View File

@ -25,10 +25,12 @@ func testRTTCommand(t *testing.T) (*cli.MockUi, *RTTCommand) {
}
func TestRTTCommand_Implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &RTTCommand{}
}
func TestRTTCommand_Run_BadArgs(t *testing.T) {
t.Parallel()
_, c := testRTTCommand(t)
if code := c.Run([]string{}); code != 1 {
@ -53,6 +55,7 @@ func TestRTTCommand_Run_BadArgs(t *testing.T) {
}
func TestRTTCommand_Run_LAN(t *testing.T) {
t.Parallel()
updatePeriod := 10 * time.Millisecond
cfg := agent.TestConfig()
cfg.ConsulConfig.CoordinateUpdatePeriod = updatePeriod
@ -154,6 +157,7 @@ func TestRTTCommand_Run_LAN(t *testing.T) {
}
func TestRTTCommand_Run_WAN(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()

View File

@ -7,9 +7,11 @@ import (
)
func TestSnapshotCommand_implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &SnapshotCommand{}
}
func TestSnapshotCommand_noTabs(t *testing.T) {
t.Parallel()
assertNoTabs(t, new(SnapshotCommand))
}

View File

@ -24,14 +24,17 @@ func testSnapshotInspectCommand(t *testing.T) (*cli.MockUi, *SnapshotInspectComm
}
func TestSnapshotInspectCommand_implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &SnapshotInspectCommand{}
}
func TestSnapshotInspectCommand_noTabs(t *testing.T) {
t.Parallel()
assertNoTabs(t, new(SnapshotInspectCommand))
}
func TestSnapshotInspectCommand_Validation(t *testing.T) {
t.Parallel()
ui, c := testSnapshotInspectCommand(t)
cases := map[string]struct {
@ -70,6 +73,7 @@ func TestSnapshotInspectCommand_Validation(t *testing.T) {
}
func TestSnapshotInspectCommand_Run(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
client := a.Client()

View File

@ -24,14 +24,17 @@ func testSnapshotRestoreCommand(t *testing.T) (*cli.MockUi, *SnapshotRestoreComm
}
func TestSnapshotRestoreCommand_implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &SnapshotRestoreCommand{}
}
func TestSnapshotRestoreCommand_noTabs(t *testing.T) {
t.Parallel()
assertNoTabs(t, new(SnapshotRestoreCommand))
}
func TestSnapshotRestoreCommand_Validation(t *testing.T) {
t.Parallel()
ui, c := testSnapshotRestoreCommand(t)
cases := map[string]struct {
@ -70,6 +73,7 @@ func TestSnapshotRestoreCommand_Validation(t *testing.T) {
}
func TestSnapshotRestoreCommand_Run(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
client := a.Client()

View File

@ -23,14 +23,17 @@ func testSnapshotSaveCommand(t *testing.T) (*cli.MockUi, *SnapshotSaveCommand) {
}
func TestSnapshotSaveCommand_implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &SnapshotSaveCommand{}
}
func TestSnapshotSaveCommand_noTabs(t *testing.T) {
t.Parallel()
assertNoTabs(t, new(SnapshotSaveCommand))
}
func TestSnapshotSaveCommand_Validation(t *testing.T) {
t.Parallel()
ui, c := testSnapshotSaveCommand(t)
cases := map[string]struct {
@ -69,6 +72,7 @@ func TestSnapshotSaveCommand_Validation(t *testing.T) {
}
func TestSnapshotSaveCommand_Run(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()
client := a.Client()

View File

@ -22,10 +22,12 @@ func testValidateCommand(t *testing.T) (*cli.MockUi, *ValidateCommand) {
}
func TestValidateCommand_implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &ValidateCommand{}
}
func TestValidateCommandFailOnEmptyFile(t *testing.T) {
t.Parallel()
tmpFile := testutil.TempFile(t, "consul")
defer os.RemoveAll(tmpFile.Name())
@ -39,6 +41,7 @@ func TestValidateCommandFailOnEmptyFile(t *testing.T) {
}
func TestValidateCommandSucceedOnEmptyDir(t *testing.T) {
t.Parallel()
td := testutil.TempDir(t, "consul")
defer os.RemoveAll(td)
@ -52,6 +55,7 @@ func TestValidateCommandSucceedOnEmptyDir(t *testing.T) {
}
func TestValidateCommandSucceedOnMinimalConfigFile(t *testing.T) {
t.Parallel()
td := testutil.TempDir(t, "consul")
defer os.RemoveAll(td)
@ -71,6 +75,7 @@ func TestValidateCommandSucceedOnMinimalConfigFile(t *testing.T) {
}
func TestValidateCommandSucceedOnMinimalConfigDir(t *testing.T) {
t.Parallel()
td := testutil.TempDir(t, "consul")
defer os.RemoveAll(td)
@ -89,6 +94,7 @@ func TestValidateCommandSucceedOnMinimalConfigDir(t *testing.T) {
}
func TestValidateCommandSucceedOnConfigDirWithEmptyFile(t *testing.T) {
t.Parallel()
td := testutil.TempDir(t, "consul")
defer os.RemoveAll(td)
@ -107,6 +113,7 @@ func TestValidateCommandSucceedOnConfigDirWithEmptyFile(t *testing.T) {
}
func TestValidateCommandQuiet(t *testing.T) {
t.Parallel()
td := testutil.TempDir(t, "consul")
defer os.RemoveAll(td)

View File

@ -7,5 +7,6 @@ import (
)
func TestVersionCommand_implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &VersionCommand{}
}

View File

@ -10,10 +10,12 @@ import (
)
func TestWatchCommand_implements(t *testing.T) {
t.Parallel()
var _ cli.Command = &WatchCommand{}
}
func TestWatchCommandRun(t *testing.T) {
t.Parallel()
a := agent.NewTestAgent(t.Name(), nil)
defer a.Shutdown()