test: use correct parallel test setup func (#18326) (#18330)

This commit is contained in:
James Rasell 2023-08-25 14:48:06 +01:00 committed by GitHub
parent 4ebd0d251f
commit 3730b66d8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 23 additions and 22 deletions

View File

@ -2072,7 +2072,7 @@ func TestAllocRunner_PersistState_Destroyed(t *testing.T) {
} }
func TestAllocRunner_Reconnect(t *testing.T) { func TestAllocRunner_Reconnect(t *testing.T) {
t.Parallel() ci.Parallel(t)
type tcase struct { type tcase struct {
clientStatus string clientStatus string

View File

@ -164,7 +164,7 @@ func TestTaskRunner_ArtifactHook_PartialDone(t *testing.T) {
// download multiple files concurrently. this is a successful test without any errors. // download multiple files concurrently. this is a successful test without any errors.
func TestTaskRunner_ArtifactHook_ConcurrentDownloadSuccess(t *testing.T) { func TestTaskRunner_ArtifactHook_ConcurrentDownloadSuccess(t *testing.T) {
ci.SkipTestWithoutRootAccess(t) ci.SkipTestWithoutRootAccess(t)
t.Parallel() ci.Parallel(t)
me := &mockEmitter{} me := &mockEmitter{}
sbox := getter.TestSandbox(t) sbox := getter.TestSandbox(t)
@ -252,7 +252,7 @@ func TestTaskRunner_ArtifactHook_ConcurrentDownloadSuccess(t *testing.T) {
// download multiple files concurrently. first iteration will result in failure and // download multiple files concurrently. first iteration will result in failure and
// second iteration should succeed without downloading already downloaded files. // second iteration should succeed without downloading already downloaded files.
func TestTaskRunner_ArtifactHook_ConcurrentDownloadFailure(t *testing.T) { func TestTaskRunner_ArtifactHook_ConcurrentDownloadFailure(t *testing.T) {
t.Parallel() ci.Parallel(t)
me := &mockEmitter{} me := &mockEmitter{}
sbox := getter.TestSandbox(t) sbox := getter.TestSandbox(t)

View File

@ -1982,7 +1982,7 @@ func Test_verifiedTasks(t *testing.T) {
} }
func TestClient_ReconnectAllocs(t *testing.T) { func TestClient_ReconnectAllocs(t *testing.T) {
t.Parallel() ci.Parallel(t)
s1, _, cleanupS1 := testServer(t, nil) s1, _, cleanupS1 := testServer(t, nil)
defer cleanupS1() defer cleanupS1()

View File

@ -10,13 +10,14 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/hashicorp/nomad/ci"
"github.com/hashicorp/nomad/testutil" "github.com/hashicorp/nomad/testutil"
"github.com/mitchellh/cli" "github.com/mitchellh/cli"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
func TestTlsCertCreateCommand_InvalidArgs(t *testing.T) { func TestTlsCertCreateCommand_InvalidArgs(t *testing.T) {
t.Parallel() ci.Parallel(t)
type testcase struct { type testcase struct {
args []string args []string
@ -44,7 +45,7 @@ func TestTlsCertCreateCommand_InvalidArgs(t *testing.T) {
for name, tc := range cases { for name, tc := range cases {
tc := tc tc := tc
t.Run(name, func(t *testing.T) { t.Run(name, func(t *testing.T) {
t.Parallel() ci.Parallel(t)
ui := cli.NewMockUi() ui := cli.NewMockUi()
cmd := &TLSCertCreateCommand{Meta: Meta{Ui: ui}} cmd := &TLSCertCreateCommand{Meta: Meta{Ui: ui}}
require.NotEqual(t, 0, cmd.Run(tc.args)) require.NotEqual(t, 0, cmd.Run(tc.args))

View File

@ -3092,7 +3092,7 @@ func TestDockerDriver_StopSignal(t *testing.T) {
func TestDockerDriver_GroupAdd(t *testing.T) { func TestDockerDriver_GroupAdd(t *testing.T) {
if !tu.IsCI() { if !tu.IsCI() {
t.Parallel() ci.Parallel(t)
} }
testutil.DockerCompatible(t) testutil.DockerCompatible(t)

View File

@ -2682,7 +2682,7 @@ func TestACL_GetRoleByName(t *testing.T) {
} }
func TestACLEndpoint_GetAuthMethod(t *testing.T) { func TestACLEndpoint_GetAuthMethod(t *testing.T) {
t.Parallel() ci.Parallel(t)
s1, root, cleanupS1 := TestACLServer(t, nil) s1, root, cleanupS1 := TestACLServer(t, nil)
defer cleanupS1() defer cleanupS1()
@ -2718,7 +2718,7 @@ func TestACLEndpoint_GetAuthMethod(t *testing.T) {
} }
func TestACLEndpoint_GetAuthMethod_Blocking(t *testing.T) { func TestACLEndpoint_GetAuthMethod_Blocking(t *testing.T) {
t.Parallel() ci.Parallel(t)
s1, root, cleanupS1 := TestACLServer(t, nil) s1, root, cleanupS1 := TestACLServer(t, nil)
defer cleanupS1() defer cleanupS1()
@ -2778,7 +2778,7 @@ func TestACLEndpoint_GetAuthMethod_Blocking(t *testing.T) {
} }
func TestACLEndpoint_GetAuthMethods(t *testing.T) { func TestACLEndpoint_GetAuthMethods(t *testing.T) {
t.Parallel() ci.Parallel(t)
s1, root, cleanupS1 := TestACLServer(t, nil) s1, root, cleanupS1 := TestACLServer(t, nil)
defer cleanupS1() defer cleanupS1()
@ -2814,7 +2814,7 @@ func TestACLEndpoint_GetAuthMethods(t *testing.T) {
} }
func TestACLEndpoint_GetAuthMethods_Blocking(t *testing.T) { func TestACLEndpoint_GetAuthMethods_Blocking(t *testing.T) {
t.Parallel() ci.Parallel(t)
s1, root, cleanupS1 := TestACLServer(t, nil) s1, root, cleanupS1 := TestACLServer(t, nil)
defer cleanupS1() defer cleanupS1()
@ -2874,7 +2874,7 @@ func TestACLEndpoint_GetAuthMethods_Blocking(t *testing.T) {
} }
func TestACLEndpoint_ListAuthMethods(t *testing.T) { func TestACLEndpoint_ListAuthMethods(t *testing.T) {
t.Parallel() ci.Parallel(t)
s1, root, cleanupS1 := TestACLServer(t, nil) s1, root, cleanupS1 := TestACLServer(t, nil)
defer cleanupS1() defer cleanupS1()
@ -2922,7 +2922,7 @@ func TestACLEndpoint_ListAuthMethods(t *testing.T) {
} }
func TestACLEndpoint_ListAuthMethods_Blocking(t *testing.T) { func TestACLEndpoint_ListAuthMethods_Blocking(t *testing.T) {
t.Parallel() ci.Parallel(t)
s1, root, cleanupS1 := TestACLServer(t, nil) s1, root, cleanupS1 := TestACLServer(t, nil)
defer cleanupS1() defer cleanupS1()
@ -2974,7 +2974,7 @@ func TestACLEndpoint_ListAuthMethods_Blocking(t *testing.T) {
} }
func TestACLEndpoint_DeleteAuthMethods(t *testing.T) { func TestACLEndpoint_DeleteAuthMethods(t *testing.T) {
t.Parallel() ci.Parallel(t)
s1, root, cleanupS1 := TestACLServer(t, nil) s1, root, cleanupS1 := TestACLServer(t, nil)
defer cleanupS1() defer cleanupS1()
@ -3010,7 +3010,7 @@ func TestACLEndpoint_DeleteAuthMethods(t *testing.T) {
} }
func TestACLEndpoint_UpsertACLAuthMethods(t *testing.T) { func TestACLEndpoint_UpsertACLAuthMethods(t *testing.T) {
t.Parallel() ci.Parallel(t)
s1, root, cleanupS1 := TestACLServer(t, nil) s1, root, cleanupS1 := TestACLServer(t, nil)
defer cleanupS1() defer cleanupS1()
@ -3483,7 +3483,7 @@ func TestACL_GetBindingRule(t *testing.T) {
} }
func TestACL_OIDCAuthURL(t *testing.T) { func TestACL_OIDCAuthURL(t *testing.T) {
t.Parallel() ci.Parallel(t)
testServer, _, testServerCleanupFn := TestACLServer(t, nil) testServer, _, testServerCleanupFn := TestACLServer(t, nil)
defer testServerCleanupFn() defer testServerCleanupFn()
@ -3564,7 +3564,7 @@ func TestACL_OIDCAuthURL(t *testing.T) {
} }
func TestACL_OIDCCompleteAuth(t *testing.T) { func TestACL_OIDCCompleteAuth(t *testing.T) {
t.Parallel() ci.Parallel(t)
testServer, _, testServerCleanupFn := TestACLServer(t, nil) testServer, _, testServerCleanupFn := TestACLServer(t, nil)
defer testServerCleanupFn() defer testServerCleanupFn()
@ -3736,7 +3736,7 @@ func TestACL_OIDCCompleteAuth(t *testing.T) {
} }
func TestACL_Login(t *testing.T) { func TestACL_Login(t *testing.T) {
t.Parallel() ci.Parallel(t)
testServer, _, testServerCleanupFn := TestACLServer(t, nil) testServer, _, testServerCleanupFn := TestACLServer(t, nil)
defer testServerCleanupFn() defer testServerCleanupFn()

View File

@ -4378,7 +4378,7 @@ func TestClientEndpoint_ShouldCreateNodeEval(t *testing.T) {
} }
func TestClientEndpoint_UpdateAlloc_Evals_ByTrigger(t *testing.T) { func TestClientEndpoint_UpdateAlloc_Evals_ByTrigger(t *testing.T) {
t.Parallel() ci.Parallel(t)
type testCase struct { type testCase struct {
name string name string

View File

@ -891,7 +891,7 @@ func TestPlanApply_EvalNodePlan_UpdateExisting(t *testing.T) {
} }
func TestPlanApply_EvalNodePlan_UpdateExisting_Ineligible(t *testing.T) { func TestPlanApply_EvalNodePlan_UpdateExisting_Ineligible(t *testing.T) {
t.Parallel() ci.Parallel(t)
alloc := mock.Alloc() alloc := mock.Alloc()
state := testStateStore(t) state := testStateStore(t)
node := mock.Node() node := mock.Node()

View File

@ -135,7 +135,7 @@ func TestPlanEndpoint_Submit_Bad(t *testing.T) {
} }
func TestPlanEndpoint_ApplyConcurrent(t *testing.T) { func TestPlanEndpoint_ApplyConcurrent(t *testing.T) {
t.Parallel() ci.Parallel(t)
s1, cleanupS1 := TestServer(t, func(c *Config) { s1, cleanupS1 := TestServer(t, func(c *Config) {
c.NumSchedulers = 0 c.NumSchedulers = 0

View File

@ -197,7 +197,7 @@ func TestServersMeetMinimumVersionIncludingFailed(t *testing.T) {
} }
func TestServersMeetMinimumVersionSuffix(t *testing.T) { func TestServersMeetMinimumVersionSuffix(t *testing.T) {
t.Parallel() ci.Parallel(t)
cases := []struct { cases := []struct {
members []serf.Member members []serf.Member