From 3730b66d8cdbdc6af98f6feda6c973ff0176bb3f Mon Sep 17 00:00:00 2001 From: James Rasell Date: Fri, 25 Aug 2023 14:48:06 +0100 Subject: [PATCH] test: use correct parallel test setup func (#18326) (#18330) --- client/allocrunner/alloc_runner_test.go | 2 +- .../taskrunner/artifact_hook_test.go | 4 ++-- client/client_test.go | 2 +- command/tls_cert_create_test.go | 5 +++-- drivers/docker/driver_test.go | 2 +- nomad/acl_endpoint_test.go | 22 +++++++++---------- nomad/node_endpoint_test.go | 2 +- nomad/plan_apply_test.go | 2 +- nomad/plan_endpoint_test.go | 2 +- nomad/util_test.go | 2 +- 10 files changed, 23 insertions(+), 22 deletions(-) diff --git a/client/allocrunner/alloc_runner_test.go b/client/allocrunner/alloc_runner_test.go index 775b1d5ff..9a3095ecc 100644 --- a/client/allocrunner/alloc_runner_test.go +++ b/client/allocrunner/alloc_runner_test.go @@ -2072,7 +2072,7 @@ func TestAllocRunner_PersistState_Destroyed(t *testing.T) { } func TestAllocRunner_Reconnect(t *testing.T) { - t.Parallel() + ci.Parallel(t) type tcase struct { clientStatus string diff --git a/client/allocrunner/taskrunner/artifact_hook_test.go b/client/allocrunner/taskrunner/artifact_hook_test.go index 51fd5a0cd..147f8a107 100644 --- a/client/allocrunner/taskrunner/artifact_hook_test.go +++ b/client/allocrunner/taskrunner/artifact_hook_test.go @@ -164,7 +164,7 @@ func TestTaskRunner_ArtifactHook_PartialDone(t *testing.T) { // download multiple files concurrently. this is a successful test without any errors. func TestTaskRunner_ArtifactHook_ConcurrentDownloadSuccess(t *testing.T) { ci.SkipTestWithoutRootAccess(t) - t.Parallel() + ci.Parallel(t) me := &mockEmitter{} 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 // second iteration should succeed without downloading already downloaded files. func TestTaskRunner_ArtifactHook_ConcurrentDownloadFailure(t *testing.T) { - t.Parallel() + ci.Parallel(t) me := &mockEmitter{} sbox := getter.TestSandbox(t) diff --git a/client/client_test.go b/client/client_test.go index 53d801d52..0aa00040a 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -1982,7 +1982,7 @@ func Test_verifiedTasks(t *testing.T) { } func TestClient_ReconnectAllocs(t *testing.T) { - t.Parallel() + ci.Parallel(t) s1, _, cleanupS1 := testServer(t, nil) defer cleanupS1() diff --git a/command/tls_cert_create_test.go b/command/tls_cert_create_test.go index 94683b006..c715dc682 100644 --- a/command/tls_cert_create_test.go +++ b/command/tls_cert_create_test.go @@ -10,13 +10,14 @@ import ( "strings" "testing" + "github.com/hashicorp/nomad/ci" "github.com/hashicorp/nomad/testutil" "github.com/mitchellh/cli" "github.com/stretchr/testify/require" ) func TestTlsCertCreateCommand_InvalidArgs(t *testing.T) { - t.Parallel() + ci.Parallel(t) type testcase struct { args []string @@ -44,7 +45,7 @@ func TestTlsCertCreateCommand_InvalidArgs(t *testing.T) { for name, tc := range cases { tc := tc t.Run(name, func(t *testing.T) { - t.Parallel() + ci.Parallel(t) ui := cli.NewMockUi() cmd := &TLSCertCreateCommand{Meta: Meta{Ui: ui}} require.NotEqual(t, 0, cmd.Run(tc.args)) diff --git a/drivers/docker/driver_test.go b/drivers/docker/driver_test.go index 92e0bc373..c1baa1d54 100644 --- a/drivers/docker/driver_test.go +++ b/drivers/docker/driver_test.go @@ -3092,7 +3092,7 @@ func TestDockerDriver_StopSignal(t *testing.T) { func TestDockerDriver_GroupAdd(t *testing.T) { if !tu.IsCI() { - t.Parallel() + ci.Parallel(t) } testutil.DockerCompatible(t) diff --git a/nomad/acl_endpoint_test.go b/nomad/acl_endpoint_test.go index 7a1ca1192..bad3989f7 100644 --- a/nomad/acl_endpoint_test.go +++ b/nomad/acl_endpoint_test.go @@ -2682,7 +2682,7 @@ func TestACL_GetRoleByName(t *testing.T) { } func TestACLEndpoint_GetAuthMethod(t *testing.T) { - t.Parallel() + ci.Parallel(t) s1, root, cleanupS1 := TestACLServer(t, nil) defer cleanupS1() @@ -2718,7 +2718,7 @@ func TestACLEndpoint_GetAuthMethod(t *testing.T) { } func TestACLEndpoint_GetAuthMethod_Blocking(t *testing.T) { - t.Parallel() + ci.Parallel(t) s1, root, cleanupS1 := TestACLServer(t, nil) defer cleanupS1() @@ -2778,7 +2778,7 @@ func TestACLEndpoint_GetAuthMethod_Blocking(t *testing.T) { } func TestACLEndpoint_GetAuthMethods(t *testing.T) { - t.Parallel() + ci.Parallel(t) s1, root, cleanupS1 := TestACLServer(t, nil) defer cleanupS1() @@ -2814,7 +2814,7 @@ func TestACLEndpoint_GetAuthMethods(t *testing.T) { } func TestACLEndpoint_GetAuthMethods_Blocking(t *testing.T) { - t.Parallel() + ci.Parallel(t) s1, root, cleanupS1 := TestACLServer(t, nil) defer cleanupS1() @@ -2874,7 +2874,7 @@ func TestACLEndpoint_GetAuthMethods_Blocking(t *testing.T) { } func TestACLEndpoint_ListAuthMethods(t *testing.T) { - t.Parallel() + ci.Parallel(t) s1, root, cleanupS1 := TestACLServer(t, nil) defer cleanupS1() @@ -2922,7 +2922,7 @@ func TestACLEndpoint_ListAuthMethods(t *testing.T) { } func TestACLEndpoint_ListAuthMethods_Blocking(t *testing.T) { - t.Parallel() + ci.Parallel(t) s1, root, cleanupS1 := TestACLServer(t, nil) defer cleanupS1() @@ -2974,7 +2974,7 @@ func TestACLEndpoint_ListAuthMethods_Blocking(t *testing.T) { } func TestACLEndpoint_DeleteAuthMethods(t *testing.T) { - t.Parallel() + ci.Parallel(t) s1, root, cleanupS1 := TestACLServer(t, nil) defer cleanupS1() @@ -3010,7 +3010,7 @@ func TestACLEndpoint_DeleteAuthMethods(t *testing.T) { } func TestACLEndpoint_UpsertACLAuthMethods(t *testing.T) { - t.Parallel() + ci.Parallel(t) s1, root, cleanupS1 := TestACLServer(t, nil) defer cleanupS1() @@ -3483,7 +3483,7 @@ func TestACL_GetBindingRule(t *testing.T) { } func TestACL_OIDCAuthURL(t *testing.T) { - t.Parallel() + ci.Parallel(t) testServer, _, testServerCleanupFn := TestACLServer(t, nil) defer testServerCleanupFn() @@ -3564,7 +3564,7 @@ func TestACL_OIDCAuthURL(t *testing.T) { } func TestACL_OIDCCompleteAuth(t *testing.T) { - t.Parallel() + ci.Parallel(t) testServer, _, testServerCleanupFn := TestACLServer(t, nil) defer testServerCleanupFn() @@ -3736,7 +3736,7 @@ func TestACL_OIDCCompleteAuth(t *testing.T) { } func TestACL_Login(t *testing.T) { - t.Parallel() + ci.Parallel(t) testServer, _, testServerCleanupFn := TestACLServer(t, nil) defer testServerCleanupFn() diff --git a/nomad/node_endpoint_test.go b/nomad/node_endpoint_test.go index dc30e400d..7b45e1465 100644 --- a/nomad/node_endpoint_test.go +++ b/nomad/node_endpoint_test.go @@ -4378,7 +4378,7 @@ func TestClientEndpoint_ShouldCreateNodeEval(t *testing.T) { } func TestClientEndpoint_UpdateAlloc_Evals_ByTrigger(t *testing.T) { - t.Parallel() + ci.Parallel(t) type testCase struct { name string diff --git a/nomad/plan_apply_test.go b/nomad/plan_apply_test.go index a8f3c26c3..86c73b48f 100644 --- a/nomad/plan_apply_test.go +++ b/nomad/plan_apply_test.go @@ -891,7 +891,7 @@ func TestPlanApply_EvalNodePlan_UpdateExisting(t *testing.T) { } func TestPlanApply_EvalNodePlan_UpdateExisting_Ineligible(t *testing.T) { - t.Parallel() + ci.Parallel(t) alloc := mock.Alloc() state := testStateStore(t) node := mock.Node() diff --git a/nomad/plan_endpoint_test.go b/nomad/plan_endpoint_test.go index 20e056d59..98047ec97 100644 --- a/nomad/plan_endpoint_test.go +++ b/nomad/plan_endpoint_test.go @@ -135,7 +135,7 @@ func TestPlanEndpoint_Submit_Bad(t *testing.T) { } func TestPlanEndpoint_ApplyConcurrent(t *testing.T) { - t.Parallel() + ci.Parallel(t) s1, cleanupS1 := TestServer(t, func(c *Config) { c.NumSchedulers = 0 diff --git a/nomad/util_test.go b/nomad/util_test.go index 75f89df63..b4ca4a773 100644 --- a/nomad/util_test.go +++ b/nomad/util_test.go @@ -197,7 +197,7 @@ func TestServersMeetMinimumVersionIncludingFailed(t *testing.T) { } func TestServersMeetMinimumVersionSuffix(t *testing.T) { - t.Parallel() + ci.Parallel(t) cases := []struct { members []serf.Member