Skip to content

Commit

Permalink
Merge pull request #2138 from Shopify/dnwe/parallel
Browse files Browse the repository at this point in the history
chore: enable t.Parallel() wherever possible
  • Loading branch information
dnwe authored Feb 10, 2022
2 parents c0a80b7 + f1b5c01 commit 6693712
Show file tree
Hide file tree
Showing 112 changed files with 504 additions and 14 deletions.
6 changes: 6 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ linters:
- misspell
# - nakedret
- nilerr
- paralleltest
# - scopelint
- staticcheck
- structcheck
Expand All @@ -72,5 +73,10 @@ linters:
issues:
exclude:
- "G404: Use of weak random number generator"
exclude-rules:
# exclude some linters from running on certains files.
- path: functional.*_test\.go
linters:
- paralleltest
# maximum count of issues with the same text. set to 0 for unlimited. default is 3.
max-same-issues: 0
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ default: fmt get update test lint

GO := go
GOBUILD := CGO_ENABLED=0 $(GO) build $(BUILD_FLAG)
GOTEST := $(GO) test -gcflags='-l' -p 3 -v -race -timeout 10m -coverprofile=profile.out -covermode=atomic
GOTEST := $(GO) test -gcflags='-l' -race -timeout 10m -coverprofile=profile.out -covermode=atomic

FILES := $(shell find . -name '*.go' -type f -not -name '*.pb.go' -not -name '*_generated.go' -not -name '*_test.go')
TESTS := $(shell find . -name '*.go' -type f -not -name '*.pb.go' -not -name '*_generated.go' -name '*_test.go')
Expand Down
2 changes: 2 additions & 0 deletions acl_create_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var (
)

func TestCreateAclsRequestv0(t *testing.T) {
t.Parallel()
req := &CreateAclsRequest{
Version: 0,
AclCreations: []*AclCreation{
Expand All @@ -47,6 +48,7 @@ func TestCreateAclsRequestv0(t *testing.T) {
}

func TestCreateAclsRequestv1(t *testing.T) {
t.Parallel()
req := &CreateAclsRequest{
Version: 1,
AclCreations: []*AclCreation{
Expand Down
1 change: 1 addition & 0 deletions acl_create_response_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var (
)

func TestCreateAclsResponse(t *testing.T) {
t.Parallel()
errmsg := "error"
resp := &CreateAclsResponse{
ThrottleTime: 100 * time.Millisecond,
Expand Down
2 changes: 2 additions & 0 deletions acl_delete_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ var (
)

func TestDeleteAclsRequest(t *testing.T) {
t.Parallel()
req := &DeleteAclsRequest{
Filters: []*AclFilter{{
ResourceType: AclResourceAny,
Expand Down Expand Up @@ -91,6 +92,7 @@ func TestDeleteAclsRequest(t *testing.T) {
}

func TestDeleteAclsRequestV1(t *testing.T) {
t.Parallel()
req := &DeleteAclsRequest{
Version: 1,
Filters: []*AclFilter{{
Expand Down
1 change: 1 addition & 0 deletions acl_delete_response_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var deleteAclsResponse = []byte{
}

func TestDeleteAclsResponse(t *testing.T) {
t.Parallel()
resp := &DeleteAclsResponse{
ThrottleTime: 100 * time.Millisecond,
FilterResponses: []*FilterResponse{{
Expand Down
2 changes: 2 additions & 0 deletions acl_describe_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var (
)

func TestAclDescribeRequestV0(t *testing.T) {
t.Parallel()
resourcename := "topic"
principal := "principal"
host := "host"
Expand All @@ -44,6 +45,7 @@ func TestAclDescribeRequestV0(t *testing.T) {
}

func TestAclDescribeRequestV1(t *testing.T) {
t.Parallel()
resourcename := "topic"
principal := "principal"
host := "host"
Expand Down
1 change: 1 addition & 0 deletions acl_describe_response_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var aclDescribeResponseError = []byte{
}

func TestAclDescribeResponse(t *testing.T) {
t.Parallel()
errmsg := "error"
resp := &DescribeAclsResponse{
ThrottleTime: 100 * time.Millisecond,
Expand Down
4 changes: 4 additions & 0 deletions acl_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
)

func TestAclOperationTextMarshal(t *testing.T) {
t.Parallel()
for i := AclOperationUnknown; i <= AclOperationIdempotentWrite; i++ {
text, err := i.MarshalText()
if err != nil {
Expand All @@ -22,6 +23,7 @@ func TestAclOperationTextMarshal(t *testing.T) {
}

func TestAclPermissionTypeTextMarshal(t *testing.T) {
t.Parallel()
for i := AclPermissionUnknown; i <= AclPermissionAllow; i++ {
text, err := i.MarshalText()
if err != nil {
Expand All @@ -39,6 +41,7 @@ func TestAclPermissionTypeTextMarshal(t *testing.T) {
}

func TestAclResourceTypeTextMarshal(t *testing.T) {
t.Parallel()
for i := AclResourceUnknown; i <= AclResourceTransactionalID; i++ {
text, err := i.MarshalText()
if err != nil {
Expand All @@ -56,6 +59,7 @@ func TestAclResourceTypeTextMarshal(t *testing.T) {
}

func TestAclResourcePatternTypeTextMarshal(t *testing.T) {
t.Parallel()
for i := AclPatternUnknown; i <= AclPatternPrefixed; i++ {
text, err := i.MarshalText()
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions add_offsets_to_txn_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var addOffsetsToTxnRequest = []byte{
}

func TestAddOffsetsToTxnRequest(t *testing.T) {
t.Parallel()
req := &AddOffsetsToTxnRequest{
TransactionalID: "txn",
ProducerID: 8000,
Expand Down
1 change: 1 addition & 0 deletions add_offsets_to_txn_response_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var addOffsetsToTxnResponse = []byte{
}

func TestAddOffsetsToTxnResponse(t *testing.T) {
t.Parallel()
resp := &AddOffsetsToTxnResponse{
ThrottleTime: 100 * time.Millisecond,
Err: ErrInvalidProducerEpoch,
Expand Down
1 change: 1 addition & 0 deletions add_partitions_to_txn_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var addPartitionsToTxnRequest = []byte{
}

func TestAddPartitionsToTxnRequest(t *testing.T) {
t.Parallel()
req := &AddPartitionsToTxnRequest{
TransactionalID: "txn",
ProducerID: 8000,
Expand Down
1 change: 1 addition & 0 deletions add_partitions_to_txn_response_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var addPartitionsToTxnResponse = []byte{
}

func TestAddPartitionsToTxnResponse(t *testing.T) {
t.Parallel()
resp := &AddPartitionsToTxnResponse{
ThrottleTime: 100 * time.Millisecond,
Errors: map[string][]*PartitionError{
Expand Down
Loading

0 comments on commit 6693712

Please sign in to comment.