Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: forbid using t.Parallel #344

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ linters:
# - errorlint
# - exhaustive
# - fatcontext
# - forbidigo
- forbidigo
- ginkgolinter
- gocheckcompilerdirectives
- gochecknoinits
Expand Down Expand Up @@ -81,7 +81,6 @@ linters:
- testableexamples
- testifylint
- thelper
# - tparallel
- unconvert
# - unparam
# - unused
Expand All @@ -90,3 +89,13 @@ linters:
- whitespace
- zerologlint
disable-all: true
# disable:
# - tparallel # Parallel tests mixes up log lines of multiple tests in the internal test runner

linters-settings:
forbidigo:
forbid:
# Parallel tests mixes up log lines of multiple tests in the internal test runner
- p: ^testing.T.Parallel$
pkg: ^testing$
analyze-types: true
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import (
)

func TestExtractor_Extract_v1_revisions(t *testing.T) {
t.Parallel()

tests := []extracttest.TestTableEntry{
{
Name: "no packages",
Expand Down Expand Up @@ -161,7 +159,6 @@ func TestExtractor_Extract_v1_revisions(t *testing.T) {

for _, tt := range tests {
t.Run(tt.Name, func(t *testing.T) {
t.Parallel()
extr := conanlock.Extractor{}

scanInput := extracttest.GenerateScanInputMock(t, tt.InputConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import (
)

func TestExtractor_Extract_v1(t *testing.T) {
t.Parallel()

tests := []extracttest.TestTableEntry{
{
Name: "invalid json",
Expand Down Expand Up @@ -233,7 +231,6 @@ func TestExtractor_Extract_v1(t *testing.T) {

for _, tt := range tests {
t.Run(tt.Name, func(t *testing.T) {
t.Parallel()
extr := conanlock.Extractor{}

scanInput := extracttest.GenerateScanInputMock(t, tt.InputConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
)

func TestExtractor_Extract_v2(t *testing.T) {
t.Parallel()
tests := []extracttest.TestTableEntry{
{
Name: "no packages",
Expand Down Expand Up @@ -160,7 +159,6 @@ func TestExtractor_Extract_v2(t *testing.T) {

for _, tt := range tests {
t.Run(tt.Name, func(t *testing.T) {
t.Parallel()
extr := conanlock.Extractor{}

scanInput := extracttest.GenerateScanInputMock(t, tt.InputConfig)
Expand Down
3 changes: 0 additions & 3 deletions extractor/filesystem/language/cpp/conanlock/conanlock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import (
)

func TestExtractor_FileRequired(t *testing.T) {
t.Parallel()

tests := []struct {
name string
inputPath string
Expand Down Expand Up @@ -57,7 +55,6 @@ func TestExtractor_FileRequired(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
e := conanlock.Extractor{}
got := e.FileRequired(simplefileapi.New(tt.inputPath, nil))
if got != tt.want {
Expand Down
6 changes: 0 additions & 6 deletions extractor/filesystem/language/golang/gomod/gomod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import (
)

func TestExtractor_FileRequired(t *testing.T) {
t.Parallel()

tests := []struct {
name string
inputPath string
Expand Down Expand Up @@ -61,7 +59,6 @@ func TestExtractor_FileRequired(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.inputPath, func(t *testing.T) {
t.Parallel()
e := gomod.Extractor{}
got := e.FileRequired(simplefileapi.New(tt.inputPath, nil))
if got != tt.want {
Expand All @@ -72,8 +69,6 @@ func TestExtractor_FileRequired(t *testing.T) {
}

func TestExtractor_Extract(t *testing.T) {
t.Parallel()

tests := []extracttest.TestTableEntry{
{
Name: "invalid",
Expand Down Expand Up @@ -265,7 +260,6 @@ func TestExtractor_Extract(t *testing.T) {

for _, tt := range tests {
t.Run(tt.Name, func(t *testing.T) {
t.Parallel()
extr := gomod.Extractor{}

scanInput := extracttest.GenerateScanInputMock(t, tt.InputConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import (
)

func TestExtractor_FileRequired(t *testing.T) {
t.Parallel()

tests := []struct {
inputPath string
want bool
Expand Down Expand Up @@ -81,7 +79,6 @@ func TestExtractor_FileRequired(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.inputPath, func(t *testing.T) {
t.Parallel()
e := gradlelockfile.Extractor{}
got := e.FileRequired(simplefileapi.New(tt.inputPath, nil))
if got != tt.want {
Expand All @@ -92,7 +89,6 @@ func TestExtractor_FileRequired(t *testing.T) {
}

func TestExtractor_Extract(t *testing.T) {
t.Parallel()
tests := []extracttest.TestTableEntry{
{
Name: "only comments",
Expand Down Expand Up @@ -208,7 +204,6 @@ func TestExtractor_Extract(t *testing.T) {

for _, tt := range tests {
t.Run(tt.Name, func(t *testing.T) {
t.Parallel()
extr := gradlelockfile.Extractor{}

scanInput := extracttest.GenerateScanInputMock(t, tt.InputConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import (
)

func TestExtractor_FileRequired(t *testing.T) {
t.Parallel()

tests := []struct {
name string
inputPath string
Expand Down Expand Up @@ -93,7 +91,6 @@ func TestExtractor_FileRequired(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
e := gradleverificationmetadataxml.Extractor{}
got := e.FileRequired(simplefileapi.New(tt.inputPath, nil))
if got != tt.want {
Expand All @@ -104,7 +101,6 @@ func TestExtractor_FileRequired(t *testing.T) {
}

func TestExtractor_Extract(t *testing.T) {
t.Parallel()
tests := []extracttest.TestTableEntry{
{
Name: "invalid xml",
Expand Down Expand Up @@ -454,7 +450,6 @@ func TestExtractor_Extract(t *testing.T) {

for _, tt := range tests {
t.Run(tt.Name, func(t *testing.T) {
t.Parallel()
extr := gradleverificationmetadataxml.Extractor{}

scanInput := extracttest.GenerateScanInputMock(t, tt.InputConfig)
Expand Down
6 changes: 0 additions & 6 deletions extractor/filesystem/language/java/pomxml/pomxml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import (
)

func TestExtractor_FileRequired(t *testing.T) {
t.Parallel()

tests := []struct {
inputPath string
want bool
Expand Down Expand Up @@ -61,7 +59,6 @@ func TestExtractor_FileRequired(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.inputPath, func(t *testing.T) {
t.Parallel()
e := pomxml.Extractor{}
got := e.FileRequired(simplefileapi.New(tt.inputPath, nil))
if got != tt.want {
Expand All @@ -72,8 +69,6 @@ func TestExtractor_FileRequired(t *testing.T) {
}

func TestExtractor_Extract(t *testing.T) {
t.Parallel()

tests := []extracttest.TestTableEntry{
{
Name: "invalid",
Expand Down Expand Up @@ -252,7 +247,6 @@ func TestExtractor_Extract(t *testing.T) {

for _, tt := range tests {
t.Run(tt.Name, func(t *testing.T) {
t.Parallel()
extr := pomxml.Extractor{}

scanInput := extracttest.GenerateScanInputMock(t, tt.InputConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ import (
)

func TestNPMLockExtractor_Extract_V1(t *testing.T) {
t.Parallel()

tests := []extracttest.TestTableEntry{
{
Name: "invalid json",
Expand Down Expand Up @@ -839,8 +837,6 @@ func TestNPMLockExtractor_Extract_V1(t *testing.T) {

for _, tt := range tests {
t.Run(tt.Name, func(t *testing.T) {
t.Parallel()

collector := testcollector.New()
extr := packagelockjson.New(packagelockjson.Config{
Stats: collector,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import (
)

func TestNPMLockExtractor_Extract_V2(t *testing.T) {
t.Parallel()

tests := []extracttest.TestTableEntry{
{
Name: "invalid json",
Expand Down Expand Up @@ -555,8 +553,6 @@ func TestNPMLockExtractor_Extract_V2(t *testing.T) {

for _, tt := range tests {
t.Run(tt.Name, func(t *testing.T) {
t.Parallel()

collector := testcollector.New()
extr := packagelockjson.New(packagelockjson.Config{
Stats: collector,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ func TestMetricCollector(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

collector := testcollector.New()
extr := packagelockjson.New(packagelockjson.Config{
Stats: collector,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ func TestExtractor_Extract_v9(t *testing.T) {

for _, tt := range tests {
t.Run(tt.Name, func(t *testing.T) {
t.Parallel()
extr := pnpmlock.Extractor{}

scanInput := extracttest.GenerateScanInputMock(t, tt.InputConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ func TestExtractor_FileRequired(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
e := pnpmlock.Extractor{}
got := e.FileRequired(simplefileapi.New(tt.inputPath, nil))
if got != tt.want {
Expand Down Expand Up @@ -685,7 +684,6 @@ func TestExtractor_Extract(t *testing.T) {

for _, tt := range tests {
t.Run(tt.Name, func(t *testing.T) {
t.Parallel()
extr := pnpmlock.Extractor{}

scanInput := extracttest.GenerateScanInputMock(t, tt.InputConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ func TestExtractor_Extract_v2(t *testing.T) {

for _, tt := range tests {
t.Run(tt.Name, func(t *testing.T) {
t.Parallel()
extr := yarnlock.Extractor{}

scanInput := extracttest.GenerateScanInputMock(t, tt.InputConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import (
)

func TestExtractor_FileRequired(t *testing.T) {
t.Parallel()

tests := []struct {
name string
inputPath string
Expand Down Expand Up @@ -68,7 +66,6 @@ func TestExtractor_FileRequired(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
e := composerlock.Extractor{}
got := e.FileRequired(simplefileapi.New(tt.inputPath, nil))
if got != tt.want {
Expand All @@ -79,8 +76,6 @@ func TestExtractor_FileRequired(t *testing.T) {
}

func TestExtractor_Extract(t *testing.T) {
t.Parallel()

tests := []extracttest.TestTableEntry{
{
Name: "invalid json",
Expand Down Expand Up @@ -199,7 +194,6 @@ func TestExtractor_Extract(t *testing.T) {

for _, tt := range tests {
t.Run(tt.Name, func(t *testing.T) {
t.Parallel()
extr := composerlock.Extractor{}

scanInput := extracttest.GenerateScanInputMock(t, tt.InputConfig)
Expand Down
6 changes: 0 additions & 6 deletions extractor/filesystem/language/python/pdmlock/pdmlock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import (
)

func TestPdmExtractor_FileRequired(t *testing.T) {
t.Parallel()

tests := []struct {
name string
inputPath string
Expand Down Expand Up @@ -74,7 +72,6 @@ func TestPdmExtractor_FileRequired(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
e := pdmlock.Extractor{}
got := e.FileRequired(simplefileapi.New(tt.inputPath, nil))
if got != tt.want {
Expand All @@ -85,8 +82,6 @@ func TestPdmExtractor_FileRequired(t *testing.T) {
}

func TestExtractor_Extract(t *testing.T) {
t.Parallel()

tests := []extracttest.TestTableEntry{
{
Name: "invalid toml",
Expand Down Expand Up @@ -230,7 +225,6 @@ func TestExtractor_Extract(t *testing.T) {

for _, tt := range tests {
t.Run(tt.Name, func(t *testing.T) {
t.Parallel()
extr := pdmlock.Extractor{}

scanInput := extracttest.GenerateScanInputMock(t, tt.InputConfig)
Expand Down
Loading
Loading