diff --git a/pkg/app/piped/cloudprovider/cloudrun/diff_test.go b/pkg/app/piped/cloudprovider/cloudrun/diff_test.go index 72d1e60eed..590da0d20d 100644 --- a/pkg/app/piped/cloudprovider/cloudrun/diff_test.go +++ b/pkg/app/piped/cloudprovider/cloudrun/diff_test.go @@ -58,6 +58,8 @@ func TestDiffResult_NoChange(t *testing.T) { } func TestDiffResult_Render(t *testing.T) { + t.Parallel() + old, err := loadServiceManifest("testdata/old_manifest.yaml") require.NoError(t, err) @@ -100,6 +102,8 @@ func TestDiffResult_Render(t *testing.T) { } func TestDiffByCommand(t *testing.T) { + t.Parallel() + testcases := []struct { name string command string @@ -140,7 +144,10 @@ func TestDiffByCommand(t *testing.T) { }, } for _, tc := range testcases { + tc := tc t.Run(tc.name, func(t *testing.T) { + t.Parallel() + old, err := loadServiceManifest(tc.oldManifest) require.NoError(t, err) diff --git a/pkg/app/piped/cloudprovider/kubernetes/diff_test.go b/pkg/app/piped/cloudprovider/kubernetes/diff_test.go index db4943e812..594c0e449f 100644 --- a/pkg/app/piped/cloudprovider/kubernetes/diff_test.go +++ b/pkg/app/piped/cloudprovider/kubernetes/diff_test.go @@ -118,6 +118,8 @@ func TestGroupManifests(t *testing.T) { } func TestDiffByCommand(t *testing.T) { + t.Parallel() + testcases := []struct { name string command string diff --git a/pkg/app/piped/cloudprovider/kubernetes/helm_test.go b/pkg/app/piped/cloudprovider/kubernetes/helm_test.go index fb20af3db1..18ef3db08e 100644 --- a/pkg/app/piped/cloudprovider/kubernetes/helm_test.go +++ b/pkg/app/piped/cloudprovider/kubernetes/helm_test.go @@ -27,6 +27,8 @@ import ( ) func TestTemplateLocalChart(t *testing.T) { + t.Parallel() + var ( ctx = context.Background() appName = "testapp" @@ -48,6 +50,8 @@ func TestTemplateLocalChart(t *testing.T) { } func TestTemplateLocalChart_WithNamespace(t *testing.T) { + t.Parallel() + var ( ctx = context.Background() appName = "testapp" diff --git a/pkg/app/piped/cloudprovider/kubernetes/kustomize_test.go b/pkg/app/piped/cloudprovider/kubernetes/kustomize_test.go index 467858da04..74e5d642ae 100644 --- a/pkg/app/piped/cloudprovider/kubernetes/kustomize_test.go +++ b/pkg/app/piped/cloudprovider/kubernetes/kustomize_test.go @@ -26,6 +26,8 @@ import ( ) func TestKustomizeTemplate(t *testing.T) { + t.Parallel() + var ( ctx = context.TODO() appName = "testapp" diff --git a/pkg/app/piped/eventwatcher/eventwatcher_test.go b/pkg/app/piped/eventwatcher/eventwatcher_test.go index 47d887cc19..7a9d3595a2 100644 --- a/pkg/app/piped/eventwatcher/eventwatcher_test.go +++ b/pkg/app/piped/eventwatcher/eventwatcher_test.go @@ -119,6 +119,8 @@ func TestModifyYAML(t *testing.T) { } func TestModifyText(t *testing.T) { + t.Parallel() + testcases := []struct { name string path string @@ -228,7 +230,9 @@ spec: }, } for _, tc := range testcases { + tc := tc t.Run(tc.name, func(t *testing.T) { + t.Parallel() got, gotUpToDate, err := modifyText(tc.path, tc.regex, tc.newValue) assert.Equal(t, tc.wantErr, err != nil) assert.Equal(t, tc.want, got) diff --git a/pkg/app/piped/executor/analysis/mannwhitney/udist_test.go b/pkg/app/piped/executor/analysis/mannwhitney/udist_test.go index a74bae4b1b..e91090bb13 100644 --- a/pkg/app/piped/executor/analysis/mannwhitney/udist_test.go +++ b/pkg/app/piped/executor/analysis/mannwhitney/udist_test.go @@ -113,6 +113,8 @@ func BenchmarkUDist(b *testing.B) { } func TestUDistTies(t *testing.T) { + t.Parallel() + makeTable := func(m, N int, t []int, minx, maxx float64) [][]float64 { out := [][]float64{} dist := UDist{N1: m, N2: N - m, T: t} diff --git a/pkg/app/piped/executor/kubernetes/kubernetes_test.go b/pkg/app/piped/executor/kubernetes/kubernetes_test.go index cc84d8e7b2..7f5a92635e 100644 --- a/pkg/app/piped/executor/kubernetes/kubernetes_test.go +++ b/pkg/app/piped/executor/kubernetes/kubernetes_test.go @@ -768,6 +768,8 @@ data: } func TestPatchManifest(t *testing.T) { + t.Parallel() + testcases := []struct { name string manifests string @@ -850,7 +852,10 @@ func TestPatchManifest(t *testing.T) { } for _, tc := range testcases { + tc := tc t.Run(tc.name, func(t *testing.T) { + t.Parallel() + manifests, err := provider.LoadManifestsFromYAMLFile(tc.manifests) require.NoError(t, err) diff --git a/pkg/app/piped/planner/kubernetes/kubernetes_test.go b/pkg/app/piped/planner/kubernetes/kubernetes_test.go index 816864372d..a33bed8f4b 100644 --- a/pkg/app/piped/planner/kubernetes/kubernetes_test.go +++ b/pkg/app/piped/planner/kubernetes/kubernetes_test.go @@ -399,6 +399,8 @@ func TestDecideStrategy(t *testing.T) { } func TestDetermineVersion(t *testing.T) { + t.Parallel() + testcases := []struct { name string manifests string @@ -428,7 +430,10 @@ func TestDetermineVersion(t *testing.T) { } for _, tc := range testcases { + tc := tc t.Run(tc.name, func(t *testing.T) { + t.Parallel() + manifests, err := provider.LoadManifestsFromYAMLFile(tc.manifests) require.NoError(t, err) diff --git a/pkg/app/piped/sourcedecrypter/decrypter_test.go b/pkg/app/piped/sourcedecrypter/decrypter_test.go index 5d7a0c622b..b1251b538a 100644 --- a/pkg/app/piped/sourcedecrypter/decrypter_test.go +++ b/pkg/app/piped/sourcedecrypter/decrypter_test.go @@ -36,9 +36,13 @@ func (d testSecretDecrypter) Decrypt(text string) (string, error) { } func TestDecryptSecrets(t *testing.T) { + t.Parallel() + workspace, err := os.MkdirTemp("", "test-decrypt-secrets") require.NoError(t, err) - defer os.RemoveAll(workspace) + t.Cleanup(func() { + os.RemoveAll(workspace) + }) dcr := testSecretDecrypter{ prefix: "decrypted-", @@ -140,7 +144,10 @@ func TestDecryptSecrets(t *testing.T) { } for _, tc := range testcases { + tc := tc t.Run(tc.name, func(t *testing.T) { + t.Parallel() + appDir, err := os.MkdirTemp(workspace, "app-dir") require.NoError(t, err) diff --git a/pkg/app/server/apikeyverifier/verifier_test.go b/pkg/app/server/apikeyverifier/verifier_test.go index 36f8bf6e92..74e4b905f7 100644 --- a/pkg/app/server/apikeyverifier/verifier_test.go +++ b/pkg/app/server/apikeyverifier/verifier_test.go @@ -43,6 +43,8 @@ func (g *fakeAPIKeyGetter) Get(_ context.Context, id string) (*model.APIKey, err } func TestVerify(t *testing.T) { + t.Parallel() + ctx, cancel := context.WithCancel(context.Background()) defer cancel() diff --git a/pkg/app/server/pipedverifier/verifier_test.go b/pkg/app/server/pipedverifier/verifier_test.go index f8af20c081..10eb6c5b4d 100644 --- a/pkg/app/server/pipedverifier/verifier_test.go +++ b/pkg/app/server/pipedverifier/verifier_test.go @@ -60,6 +60,8 @@ func (g *fakePipedGetter) Get(_ context.Context, id string) (*model.Piped, error } func TestVerify(t *testing.T) { + t.Parallel() + ctx, cancel := context.WithCancel(context.Background()) defer cancel() diff --git a/pkg/config/application_test.go b/pkg/config/application_test.go index 8dab23cca1..b596fa2e3c 100644 --- a/pkg/config/application_test.go +++ b/pkg/config/application_test.go @@ -340,6 +340,8 @@ func TestGenericTriggerConfiguration(t *testing.T) { } func TestTrueByDefaultBoolConfiguration(t *testing.T) { + t.Parallel() + testcases := []struct { fileName string expectedKind Kind @@ -436,7 +438,10 @@ func TestTrueByDefaultBoolConfiguration(t *testing.T) { }, } for _, tc := range testcases { + tc := tc t.Run(tc.fileName, func(t *testing.T) { + t.Parallel() + cfg, err := LoadFromYAML(tc.fileName) require.Equal(t, tc.expectedError, err) if err == nil { diff --git a/pkg/crypto/key_test.go b/pkg/crypto/key_test.go index ecbfd0c037..5d98d19124 100644 --- a/pkg/crypto/key_test.go +++ b/pkg/crypto/key_test.go @@ -25,6 +25,8 @@ import ( ) func TestGenerateRSAPems(t *testing.T) { + t.Parallel() + private, public, err := GenerateRSAPems(0) require.Error(t, err) assert.Nil(t, private) diff --git a/pkg/git/repo_test.go b/pkg/git/repo_test.go index 25aaa6275f..9411ecf5cb 100644 --- a/pkg/git/repo_test.go +++ b/pkg/git/repo_test.go @@ -26,6 +26,8 @@ import ( ) func TestGetCommitHashForRev(t *testing.T) { + t.Parallel() + faker, err := newFaker() require.NoError(t, err) defer faker.clean() @@ -53,6 +55,8 @@ func TestGetCommitHashForRev(t *testing.T) { } func TestChangedFiles(t *testing.T) { + t.Parallel() + faker, err := newFaker() require.NoError(t, err) defer faker.clean() @@ -104,6 +108,8 @@ func TestChangedFiles(t *testing.T) { } func TestAddCommit(t *testing.T) { + t.Parallel() + faker, err := newFaker() require.NoError(t, err) defer faker.clean() @@ -142,6 +148,8 @@ func TestAddCommit(t *testing.T) { } func TestCommitChanges(t *testing.T) { + t.Parallel() + faker, err := newFaker() require.NoError(t, err) defer faker.clean() diff --git a/pkg/jwt/verifier_test.go b/pkg/jwt/verifier_test.go index c98e42f505..d9f29bdea3 100644 --- a/pkg/jwt/verifier_test.go +++ b/pkg/jwt/verifier_test.go @@ -28,6 +28,8 @@ import ( ) func TestVerify(t *testing.T) { + t.Parallel() + now := time.Now() testcases := []struct { @@ -110,7 +112,10 @@ func TestVerify(t *testing.T) { testFunc := func(s Signer, v Verifier) { for _, tc := range testcases { + tc := tc t.Run(tc.name, func(t *testing.T) { + t.Parallel() + token, err := s.Sign(tc.claims) require.NoError(t, err) require.True(t, len(token) > 0) diff --git a/pkg/model/apikey_test.go b/pkg/model/apikey_test.go index eb97eb34dd..a054afe40e 100644 --- a/pkg/model/apikey_test.go +++ b/pkg/model/apikey_test.go @@ -22,6 +22,8 @@ import ( ) func TestGenerateAPIKey(t *testing.T) { + t.Parallel() + id := "test-id" key, hash, err := GenerateAPIKey(id) require.NoError(t, err) diff --git a/pkg/model/piped_test.go b/pkg/model/piped_test.go index de731fe04c..77b51e91ab 100644 --- a/pkg/model/piped_test.go +++ b/pkg/model/piped_test.go @@ -24,6 +24,8 @@ import ( ) func TestGeneratePipedKey(t *testing.T) { + t.Parallel() + key, hash, err := GeneratePipedKey() assert.NoError(t, err) assert.True(t, len(key) > 0) @@ -31,6 +33,8 @@ func TestGeneratePipedKey(t *testing.T) { } func TestPipedCheckKey(t *testing.T) { + t.Parallel() + key, hash, err := GeneratePipedKey() require.NoError(t, err) diff --git a/pkg/model/project_test.go b/pkg/model/project_test.go index 984e9b9690..a1bbafa7d8 100644 --- a/pkg/model/project_test.go +++ b/pkg/model/project_test.go @@ -77,6 +77,8 @@ func TestRedactSensitiveData(t *testing.T) { } func TestUpdateProjectStaticUser(t *testing.T) { + t.Parallel() + cases := []struct { name string username string @@ -94,7 +96,9 @@ func TestUpdateProjectStaticUser(t *testing.T) { } for _, tc := range cases { + tc := tc t.Run(tc.name, func(t *testing.T) { + t.Parallel() p := &ProjectStaticUser{} p.Update(tc.username, tc.password) assert.Equal(t, tc.expectUsername, p.Username)