Skip to content

Commit

Permalink
Merge pull request #12313 from hashicorp/purge-parallel-2
Browse files Browse the repository at this point in the history
ci: more parallel removal
  • Loading branch information
shoenig committed Mar 17, 2022
2 parents eca4ac6 + fec8d6e commit 4bf0dec
Show file tree
Hide file tree
Showing 34 changed files with 260 additions and 195 deletions.
11 changes: 11 additions & 0 deletions .semgrep/go_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,14 @@ rules:
exclude: ["*"]
include:
- "*_test.go"
- id: "tests-no-parallel"
patterns:
- pattern: "t.Parallel()"
message: "Use ci.Parallel(t) instead of t.Parallel()"
languages:
- "go"
severity: "WARNING"
fix: "ci.Parallel(t)"
paths:
include:
- "*_test.go"
19 changes: 10 additions & 9 deletions api/acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package api
import (
"testing"

"github.com/hashicorp/nomad/api/internal/testutil"
"github.com/stretchr/testify/assert"
)

func TestACLPolicies_ListUpsert(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
c, s, _ := makeACLClient(t, nil, nil)
defer s.Stop()
ap := c.ACLPolicies()
Expand Down Expand Up @@ -49,7 +50,7 @@ func TestACLPolicies_ListUpsert(t *testing.T) {
}

func TestACLPolicies_Delete(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
c, s, _ := makeACLClient(t, nil, nil)
defer s.Stop()
ap := c.ACLPolicies()
Expand Down Expand Up @@ -84,7 +85,7 @@ func TestACLPolicies_Delete(t *testing.T) {
}

func TestACLPolicies_Info(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
c, s, _ := makeACLClient(t, nil, nil)
defer s.Stop()
ap := c.ACLPolicies()
Expand All @@ -110,7 +111,7 @@ func TestACLPolicies_Info(t *testing.T) {
}

func TestACLTokens_List(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
c, s, _ := makeACLClient(t, nil, nil)
defer s.Stop()
at := c.ACLTokens()
Expand All @@ -129,7 +130,7 @@ func TestACLTokens_List(t *testing.T) {
}

func TestACLTokens_CreateUpdate(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
c, s, _ := makeACLClient(t, nil, nil)
defer s.Stop()
at := c.ACLTokens()
Expand Down Expand Up @@ -158,7 +159,7 @@ func TestACLTokens_CreateUpdate(t *testing.T) {
}

func TestACLTokens_Info(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
c, s, _ := makeACLClient(t, nil, nil)
defer s.Stop()
at := c.ACLTokens()
Expand All @@ -183,7 +184,7 @@ func TestACLTokens_Info(t *testing.T) {
}

func TestACLTokens_Self(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
c, s, _ := makeACLClient(t, nil, nil)
defer s.Stop()
at := c.ACLTokens()
Expand Down Expand Up @@ -213,7 +214,7 @@ func TestACLTokens_Self(t *testing.T) {
}

func TestACLTokens_Delete(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
c, s, _ := makeACLClient(t, nil, nil)
defer s.Stop()
at := c.ACLTokens()
Expand All @@ -237,7 +238,7 @@ func TestACLTokens_Delete(t *testing.T) {
}

func TestACL_OneTimeToken(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
c, s, _ := makeACLClient(t, nil, nil)
defer s.Stop()
at := c.ACLTokens()
Expand Down
37 changes: 18 additions & 19 deletions api/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ import (
"testing"
"time"

"github.com/kr/pretty"
"github.com/stretchr/testify/require"

"github.com/hashicorp/nomad/api/internal/testutil"
"github.com/kr/pretty"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestAgent_Self(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
c, s := makeClient(t, nil, nil)
defer s.Stop()

Expand All @@ -42,7 +41,7 @@ func TestAgent_Self(t *testing.T) {
}

func TestAgent_NodeName(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
c, s := makeClient(t, nil, nil)
defer s.Stop()
a := c.Agent()
Expand All @@ -58,7 +57,7 @@ func TestAgent_NodeName(t *testing.T) {
}

func TestAgent_Datacenter(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
c, s := makeClient(t, nil, nil)
defer s.Stop()
a := c.Agent()
Expand All @@ -74,7 +73,7 @@ func TestAgent_Datacenter(t *testing.T) {
}

func TestAgent_Join(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
c1, s1 := makeClient(t, nil, nil)
defer s1.Stop()
a1 := c1.Agent()
Expand Down Expand Up @@ -104,7 +103,7 @@ func TestAgent_Join(t *testing.T) {
}

func TestAgent_Members(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
c, s := makeClient(t, nil, nil)
defer s.Stop()
a := c.Agent()
Expand All @@ -125,7 +124,7 @@ func TestAgent_Members(t *testing.T) {
}

func TestAgent_ForceLeave(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
c, s := makeClient(t, nil, nil)
defer s.Stop()
a := c.Agent()
Expand All @@ -143,7 +142,7 @@ func (a *AgentMember) String() string {
}

func TestAgents_Sort(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
var sortTests = []struct {
in []*AgentMember
out []*AgentMember
Expand Down Expand Up @@ -254,7 +253,7 @@ func TestAgents_Sort(t *testing.T) {
}

func TestAgent_Health(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
assert := assert.New(t)
c, s := makeClient(t, nil, nil)
defer s.Stop()
Expand All @@ -269,7 +268,7 @@ func TestAgent_Health(t *testing.T) {
// passing in a log level and node ie, which tests monitor
// functionality for a specific client node
func TestAgent_MonitorWithNode(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
rpcPort := 0
c, s := makeClient(t, nil, func(c *testutil.TestServerConfig) {
rpcPort = c.Ports.RPC
Expand Down Expand Up @@ -339,7 +338,7 @@ OUTER:
// passing in only a log level, which tests the servers
// monitor functionality
func TestAgent_Monitor(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
c, s := makeClient(t, nil, nil)
defer s.Stop()

Expand Down Expand Up @@ -379,7 +378,7 @@ OUTER:
}

func TestAgentCPUProfile(t *testing.T) {
t.Parallel()
testutil.Parallel(t)

c, s, token := makeACLClient(t, nil, nil)
defer s.Stop()
Expand Down Expand Up @@ -415,7 +414,7 @@ func TestAgentCPUProfile(t *testing.T) {
}

func TestAgentTrace(t *testing.T) {
t.Parallel()
testutil.Parallel(t)

c, s, token := makeACLClient(t, nil, nil)
defer s.Stop()
Expand All @@ -432,7 +431,7 @@ func TestAgentTrace(t *testing.T) {
}

func TestAgentProfile(t *testing.T) {
t.Parallel()
testutil.Parallel(t)

c, s, token := makeACLClient(t, nil, nil)
defer s.Stop()
Expand All @@ -459,7 +458,7 @@ func TestAgentProfile(t *testing.T) {
}

func TestAgent_SchedulerWorkerConfig(t *testing.T) {
t.Parallel()
testutil.Parallel(t)

c, s := makeClient(t, nil, nil)
defer s.Stop()
Expand All @@ -475,7 +474,7 @@ func TestAgent_SchedulerWorkerConfig(t *testing.T) {
}

func TestAgent_SchedulerWorkerConfig_BadRequest(t *testing.T) {
t.Parallel()
testutil.Parallel(t)

c, s := makeClient(t, nil, nil)
defer s.Stop()
Expand All @@ -491,7 +490,7 @@ func TestAgent_SchedulerWorkerConfig_BadRequest(t *testing.T) {
}

func TestAgent_SchedulerWorkersInfo(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
c, s := makeClient(t, nil, nil)
defer s.Stop()
a := c.Agent()
Expand Down
16 changes: 8 additions & 8 deletions api/allocations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

func TestAllocations_List(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
c, s := makeClient(t, nil, func(c *testutil.TestServerConfig) {
c.DevMode = true
})
Expand Down Expand Up @@ -58,7 +58,7 @@ func TestAllocations_List(t *testing.T) {
}

func TestAllocations_PrefixList(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
c, s := makeClient(t, nil, nil)
defer s.Stop()
a := c.Allocations()
Expand Down Expand Up @@ -106,7 +106,7 @@ func TestAllocations_PrefixList(t *testing.T) {
}

func TestAllocations_List_Resources(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
c, s := makeClient(t, nil, func(c *testutil.TestServerConfig) {
c.DevMode = true
})
Expand Down Expand Up @@ -137,7 +137,7 @@ func TestAllocations_List_Resources(t *testing.T) {
}

func TestAllocations_CreateIndexSort(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
allocs := []*AllocationListStub{
{CreateIndex: 2},
{CreateIndex: 1},
Expand All @@ -156,7 +156,7 @@ func TestAllocations_CreateIndexSort(t *testing.T) {
}

func TestAllocations_RescheduleInfo(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
// Create a job, task group and alloc
job := &Job{
Name: stringToPtr("foo"),
Expand Down Expand Up @@ -317,7 +317,7 @@ func TestAllocations_ExecErrors(t *testing.T) {
}

func TestAllocation_ServerTerminalStatus(t *testing.T) {
t.Parallel()
testutil.Parallel(t)

testCases := []struct {
inputAllocation *Allocation
Expand Down Expand Up @@ -349,7 +349,7 @@ func TestAllocation_ServerTerminalStatus(t *testing.T) {
}

func TestAllocation_ClientTerminalStatus(t *testing.T) {
t.Parallel()
testutil.Parallel(t)

testCases := []struct {
inputAllocation *Allocation
Expand Down Expand Up @@ -391,7 +391,7 @@ func TestAllocation_ClientTerminalStatus(t *testing.T) {
}

func TestAllocations_ShouldMigrate(t *testing.T) {
t.Parallel()
testutil.Parallel(t)
require.True(t, DesiredTransition{Migrate: boolToPtr(true)}.ShouldMigrate())
require.False(t, DesiredTransition{}.ShouldMigrate())
require.False(t, DesiredTransition{Migrate: boolToPtr(false)}.ShouldMigrate())
Expand Down
Loading

0 comments on commit 4bf0dec

Please sign in to comment.