diff --git a/.golangci.yml b/.golangci.yml index 350c4328..64686942 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -75,7 +75,6 @@ linters: - wrapcheck disable: - exhaustruct # initializing every struct makes tests longer without much benefit (spencerschrock) - - paralleltest # need to investigate rate limit issues before re-enabling? (#2527) - testpackage # tests don't need their own package (spencerschrock) presets: - bugs diff --git a/attestor/command/cli_test.go b/attestor/command/cli_test.go index ca0a7d49..0ba51627 100644 --- a/attestor/command/cli_test.go +++ b/attestor/command/cli_test.go @@ -20,43 +20,41 @@ import ( ) func Test_addSignFlags(t *testing.T) { + t.Parallel() type args struct { cmd *cobra.Command } - testName := "Test addSignFlags" testArgs := args{ cmd: &cobra.Command{}, } - t.Run(testName, func(t *testing.T) { - addSignFlags(testArgs.cmd) - // persistent flags of Image being set has to be tested in the integration test - if testArgs.cmd.PersistentFlags().Lookup("image") == nil { - t.Errorf("addSignFlags() did not add persistent flag 'image'") - } - if testArgs.cmd.PersistentFlags().Lookup("attestation-project") == nil { - t.Errorf("addSignFlags() did not add persistent flag 'attestation-project'") - } - if testArgs.cmd.PersistentFlags().Lookup("overwrite") == nil { - t.Errorf("addSignFlags() did not add persistent flag 'overwrite'") - } - if testArgs.cmd.PersistentFlags().Lookup("kms-key-name") == nil { - t.Errorf("addSignFlags() did not add persistent flag 'kms-key-name'") - } - if testArgs.cmd.PersistentFlags().Lookup("kms-digest-alg") == nil { - t.Errorf("addSignFlags() did not add persistent flag 'kms-digest-alg'") - } - if testArgs.cmd.PersistentFlags().Lookup("pgp-private-key") == nil { - t.Errorf("addSignFlags() did not add persistent flag 'pgp-private-key'") - } - if testArgs.cmd.PersistentFlags().Lookup("pgp-passphrase") == nil { - t.Errorf("addSignFlags() did not add persistent flag 'pgp-passphrase'") - } - if testArgs.cmd.PersistentFlags().Lookup("pkix-private-key") == nil { - t.Errorf("addSignFlags() did not add persistent flag 'pkix-private-key'") - } - if testArgs.cmd.PersistentFlags().Lookup("pkix-alg") == nil { - t.Errorf("addSignFlags() did not add persistent flag 'pkix-alg'") - } - }) + addSignFlags(testArgs.cmd) + // persistent flags of Image being set has to be tested in the integration test + if testArgs.cmd.PersistentFlags().Lookup("image") == nil { + t.Errorf("addSignFlags() did not add persistent flag 'image'") + } + if testArgs.cmd.PersistentFlags().Lookup("attestation-project") == nil { + t.Errorf("addSignFlags() did not add persistent flag 'attestation-project'") + } + if testArgs.cmd.PersistentFlags().Lookup("overwrite") == nil { + t.Errorf("addSignFlags() did not add persistent flag 'overwrite'") + } + if testArgs.cmd.PersistentFlags().Lookup("kms-key-name") == nil { + t.Errorf("addSignFlags() did not add persistent flag 'kms-key-name'") + } + if testArgs.cmd.PersistentFlags().Lookup("kms-digest-alg") == nil { + t.Errorf("addSignFlags() did not add persistent flag 'kms-digest-alg'") + } + if testArgs.cmd.PersistentFlags().Lookup("pgp-private-key") == nil { + t.Errorf("addSignFlags() did not add persistent flag 'pgp-private-key'") + } + if testArgs.cmd.PersistentFlags().Lookup("pgp-passphrase") == nil { + t.Errorf("addSignFlags() did not add persistent flag 'pgp-passphrase'") + } + if testArgs.cmd.PersistentFlags().Lookup("pkix-private-key") == nil { + t.Errorf("addSignFlags() did not add persistent flag 'pkix-private-key'") + } + if testArgs.cmd.PersistentFlags().Lookup("pkix-alg") == nil { + t.Errorf("addSignFlags() did not add persistent flag 'pkix-alg'") + } } diff --git a/checker/detail_logger_impl_test.go b/checker/detail_logger_impl_test.go index c1cebcb8..e81901d3 100644 --- a/checker/detail_logger_impl_test.go +++ b/checker/detail_logger_impl_test.go @@ -18,6 +18,7 @@ import ( ) func Test_logger_Info(t *testing.T) { + t.Parallel() l := &logger{ logs: []CheckDetail{}, } @@ -28,6 +29,7 @@ func Test_logger_Info(t *testing.T) { } func Test_logger_Warn(t *testing.T) { + t.Parallel() l := &logger{ logs: []CheckDetail{}, } @@ -38,6 +40,7 @@ func Test_logger_Warn(t *testing.T) { } func Test_logger_Flush(t *testing.T) { + t.Parallel() l := &logger{ logs: []CheckDetail{}, } @@ -52,6 +55,7 @@ func Test_logger_Flush(t *testing.T) { } func Test_logger_Logs(t *testing.T) { + t.Parallel() l := &logger{ logs: []CheckDetail{}, } @@ -62,6 +66,7 @@ func Test_logger_Logs(t *testing.T) { } func Test_logger_Debug(t *testing.T) { + t.Parallel() l := &logger{ logs: []CheckDetail{}, } @@ -72,6 +77,7 @@ func Test_logger_Debug(t *testing.T) { } func TestNewLogger(t *testing.T) { + t.Parallel() l := NewLogger() if l == nil { t.Errorf("expected non-nil logger, got nil") diff --git a/checker/raw_result_test.go b/checker/raw_result_test.go index 7c519e73..4a04d7d0 100644 --- a/checker/raw_result_test.go +++ b/checker/raw_result_test.go @@ -20,6 +20,7 @@ import ( ) func TestFile_Location(t *testing.T) { + t.Parallel() file := File{ Type: finding.FileTypeSource, Path: "bar.go", diff --git a/checks/evaluation/pinned_dependencies_test.go b/checks/evaluation/pinned_dependencies_test.go index c90c07e7..41b6d6c6 100644 --- a/checks/evaluation/pinned_dependencies_test.go +++ b/checks/evaluation/pinned_dependencies_test.go @@ -988,6 +988,7 @@ func Test_addWorkflowPinnedResult(t *testing.T) { } func TestGenerateText(t *testing.T) { + t.Parallel() tests := []struct { name string dependency *checker.Dependency @@ -1016,7 +1017,9 @@ func TestGenerateText(t *testing.T) { } for _, tc := range tests { + tc := tc t.Run(tc.name, func(t *testing.T) { + t.Parallel() result := generateTextUnpinned(tc.dependency) if !cmp.Equal(tc.expectedText, result) { t.Errorf("generateText mismatch (-want +got):\n%s", cmp.Diff(tc.expectedText, result)) diff --git a/checks/evaluation/signed_releases_test.go b/checks/evaluation/signed_releases_test.go index 35cf5cff..53a8ee36 100644 --- a/checks/evaluation/signed_releases_test.go +++ b/checks/evaluation/signed_releases_test.go @@ -26,6 +26,7 @@ import ( ) func TestSignedReleases(t *testing.T) { + t.Parallel() tests := []struct { name string releases []clients.Release @@ -93,7 +94,9 @@ func TestSignedReleases(t *testing.T) { } for _, tc := range tests { + tc := tc t.Run(tc.name, func(t *testing.T) { + t.Parallel() dl := &scut.TestDetailLogger{} data := &checker.SignedReleasesData{Releases: tc.releases} actualResult := SignedReleases("Signed-Releases", dl, data) diff --git a/checks/raw/binary_artifact_test.go b/checks/raw/binary_artifact_test.go index ae9970bc..ace73e34 100644 --- a/checks/raw/binary_artifact_test.go +++ b/checks/raw/binary_artifact_test.go @@ -258,6 +258,7 @@ func TestBinaryArtifacts(t *testing.T) { } func TestBinaryArtifacts_workflow_runs_unsupported(t *testing.T) { + t.Parallel() ctrl := gomock.NewController(t) mockRepoClient := mockrepo.NewMockRepoClient(ctrl) const jarFile = "gradle-wrapper.jar" diff --git a/checks/raw/contributors_test.go b/checks/raw/contributors_test.go index 7b2da17c..f7a2c51d 100644 --- a/checks/raw/contributors_test.go +++ b/checks/raw/contributors_test.go @@ -105,6 +105,7 @@ func TestOrgContains(t *testing.T) { } func TestContributors(t *testing.T) { + t.Parallel() ctrl := gomock.NewController(t) defer ctrl.Finish() diff --git a/checks/raw/license_test.go b/checks/raw/license_test.go index ce5a6031..bc54e26c 100644 --- a/checks/raw/license_test.go +++ b/checks/raw/license_test.go @@ -646,7 +646,6 @@ func TestLicenseFileCheck(t *testing.T) { }, } - //nolint:paralleltest for _, tt := range tests { tt := tt // Re-initializing variable so it is not changed while executing the closure below for _, ext := range tt.extensions { diff --git a/checks/raw/maintained_test.go b/checks/raw/maintained_test.go index 21171756..5dc5db82 100644 --- a/checks/raw/maintained_test.go +++ b/checks/raw/maintained_test.go @@ -26,6 +26,7 @@ import ( mockrepo "github.com/ossf/scorecard/v4/clients/mockclients" ) +//nolint:paralleltest // need to break into separate tests func TestMaintained(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() diff --git a/checks/raw/shell_download_validate_test.go b/checks/raw/shell_download_validate_test.go index e7f615ca..44dfe065 100644 --- a/checks/raw/shell_download_validate_test.go +++ b/checks/raw/shell_download_validate_test.go @@ -112,6 +112,7 @@ func TestValidateShellFile(t *testing.T) { } func Test_isDotNetUnpinnedDownload(t *testing.T) { + t.Parallel() type args struct { cmd []string } @@ -206,7 +207,9 @@ func Test_isDotNetUnpinnedDownload(t *testing.T) { }, } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { + t.Parallel() if got := isNugetUnpinnedDownload(tt.args.cmd); got != tt.want { t.Errorf("isNugetUnpinnedDownload() = %v, want %v", got, tt.want) } @@ -215,6 +218,7 @@ func Test_isDotNetUnpinnedDownload(t *testing.T) { } func Test_isGoUnpinnedDownload(t *testing.T) { + t.Parallel() type args struct { cmd []string } @@ -239,7 +243,9 @@ func Test_isGoUnpinnedDownload(t *testing.T) { }, } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { + t.Parallel() if got := isGoUnpinnedDownload(tt.args.cmd); got != tt.want { t.Errorf("isGoUnpinnedDownload() = %v, want %v", got, tt.want) } @@ -248,6 +254,7 @@ func Test_isGoUnpinnedDownload(t *testing.T) { } func Test_isNpmDownload(t *testing.T) { + t.Parallel() type args struct { cmd []string } @@ -272,7 +279,9 @@ func Test_isNpmDownload(t *testing.T) { }, } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { + t.Parallel() if got := isNpmDownload(tt.args.cmd); got != tt.want { t.Errorf("isNpmDownload() = %v, want %v", got, tt.want) } @@ -281,6 +290,7 @@ func Test_isNpmDownload(t *testing.T) { } func Test_isNpmUnpinnedDownload(t *testing.T) { + t.Parallel() type args struct { cmd []string } @@ -305,7 +315,9 @@ func Test_isNpmUnpinnedDownload(t *testing.T) { }, } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { + t.Parallel() if got := isNpmUnpinnedDownload(tt.args.cmd); got != tt.want { t.Errorf("isNpmUnpinnedDownload() = %v, want %v", got, tt.want) } diff --git a/clients/git/client_test.go b/clients/git/client_test.go index 483bad59..0bfa45a2 100644 --- a/clients/git/client_test.go +++ b/clients/git/client_test.go @@ -77,8 +77,8 @@ func createTestRepo(t *testing.T) (path string) { return dir } -//nolint:paralleltest func TestInitRepo(t *testing.T) { + t.Parallel() tests := []struct { //nolint:govet name string uri string @@ -112,6 +112,7 @@ func TestInitRepo(t *testing.T) { for _, test := range tests { test := test t.Run(test.name, func(t *testing.T) { + t.Parallel() uri := fmt.Sprintf(test.uri, repoPath) client := &Client{} @@ -124,6 +125,7 @@ func TestInitRepo(t *testing.T) { } func TestListCommits(t *testing.T) { + t.Parallel() repoPath := createTestRepo(t) client := &Client{} @@ -147,8 +149,8 @@ func TestListCommits(t *testing.T) { } } -//nolint:paralleltest func TestSearch(t *testing.T) { + t.Parallel() testCases := []struct { name string request clients.SearchRequest @@ -215,7 +217,9 @@ func TestSearch(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.name, func(t *testing.T) { + t.Parallel() client := &Client{} uri := fmt.Sprintf("file://%s", repoPath) if err := client.InitRepo(uri, "HEAD", 1); err != nil { diff --git a/clients/githubrepo/checkruns_test.go b/clients/githubrepo/checkruns_test.go index 2d12d68e..ad563926 100644 --- a/clients/githubrepo/checkruns_test.go +++ b/clients/githubrepo/checkruns_test.go @@ -22,6 +22,7 @@ import ( ) func Test_init_clearsErr(t *testing.T) { + t.Parallel() handler := &checkrunsHandler{errSetup: sce.ErrScorecardInternal} handler.init(context.Background(), nil, 0) if handler.errSetup != nil { diff --git a/clients/githubrepo/graphql_test.go b/clients/githubrepo/graphql_test.go index 0edb5243..1dd95aa9 100644 --- a/clients/githubrepo/graphql_test.go +++ b/clients/githubrepo/graphql_test.go @@ -35,6 +35,7 @@ func (b badGatewayRoundTripper) RoundTrip(*http.Request) (*http.Response, error) } func Test_getCommits_retry(t *testing.T) { + t.Parallel() var nRequests int rt := badGatewayRoundTripper{requestCounter: &nRequests} handler := graphqlHandler{ diff --git a/clients/githubrepo/internal/fnmatch/fnmatch_test.go b/clients/githubrepo/internal/fnmatch/fnmatch_test.go index 3059568b..617506a3 100644 --- a/clients/githubrepo/internal/fnmatch/fnmatch_test.go +++ b/clients/githubrepo/internal/fnmatch/fnmatch_test.go @@ -19,6 +19,7 @@ import ( ) func TestMatch(t *testing.T) { + t.Parallel() tests := []struct { pattern string path string diff --git a/clients/githubrepo/roundtripper/tokens/accessor_test.go b/clients/githubrepo/roundtripper/tokens/accessor_test.go index 129b959c..0996f984 100644 --- a/clients/githubrepo/roundtripper/tokens/accessor_test.go +++ b/clients/githubrepo/roundtripper/tokens/accessor_test.go @@ -20,7 +20,7 @@ import ( "testing" ) -//nolint:paralleltest +//nolint:paralleltest // test uses t.Setenv func TestMakeTokenAccessor(t *testing.T) { tests := []struct { name string diff --git a/clients/githubrepo/roundtripper/tokens/round_robin_test.go b/clients/githubrepo/roundtripper/tokens/round_robin_test.go index f6a4e20b..ac9e846e 100644 --- a/clients/githubrepo/roundtripper/tokens/round_robin_test.go +++ b/clients/githubrepo/roundtripper/tokens/round_robin_test.go @@ -17,7 +17,7 @@ import ( "testing" ) -//golint:paralleltest +//nolint:paralleltest // order dependent func TestNext(t *testing.T) { tokens := []string{"token1", "token2", "token3", "token4", "token5"} rr := makeRoundRobinAccessor(tokens) @@ -35,6 +35,7 @@ func TestNext(t *testing.T) { } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { if tt.releaseID != nil { rr.Release(*tt.releaseID) diff --git a/clients/githubrepo/roundtripper/tokens/rpc_test.go b/clients/githubrepo/roundtripper/tokens/rpc_test.go index 2a0c74b5..f8a259a9 100644 --- a/clients/githubrepo/roundtripper/tokens/rpc_test.go +++ b/clients/githubrepo/roundtripper/tokens/rpc_test.go @@ -45,6 +45,7 @@ func newMockTokenAccessor(tokens []string) *mockTokenAccessor { } func TestTokenOverRPC_Next(t *testing.T) { + t.Parallel() mockClient := newMockTokenAccessor([]string{"token1", "token2", "token3"}) rpc := NewTokenOverRPC(mockClient) token := &Token{} @@ -66,6 +67,7 @@ func TestTokenOverRPC_Next(t *testing.T) { } func TestTokenOverRPC_Release(t *testing.T) { + t.Parallel() mockClient := newMockTokenAccessor([]string{"token1", "token2", "token3"}) rpc := NewTokenOverRPC(mockClient) diff --git a/clients/gitlabrepo/repo_test.go b/clients/gitlabrepo/repo_test.go index a46250de..c5f8d018 100644 --- a/clients/gitlabrepo/repo_test.go +++ b/clients/gitlabrepo/repo_test.go @@ -119,6 +119,7 @@ func TestRepoURL_IsValid(t *testing.T) { } func TestRepoURL_MakeGitLabRepo(t *testing.T) { + t.Parallel() tests := []struct { repouri string expected bool diff --git a/clients/ossfuzz/client_test.go b/clients/ossfuzz/client_test.go index dbb856fd..cb7d455b 100644 --- a/clients/ossfuzz/client_test.go +++ b/clients/ossfuzz/client_test.go @@ -198,6 +198,7 @@ func setupServer(t *testing.T) string { } func TestAllClientMethods(t *testing.T) { + t.Parallel() c := CreateOSSFuzzClient("testURL") // Test InitRepo diff --git a/cmd/internal/scdiff/app/compare/compare_test.go b/cmd/internal/scdiff/app/compare/compare_test.go index a36146a1..3625e650 100644 --- a/cmd/internal/scdiff/app/compare/compare_test.go +++ b/cmd/internal/scdiff/app/compare/compare_test.go @@ -22,6 +22,7 @@ import ( ) func TestResults(t *testing.T) { + t.Parallel() //nolint:govet // field alignment tests := []struct { name string @@ -213,7 +214,9 @@ func TestResults(t *testing.T) { }, } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { + t.Parallel() if got := Results(tt.a, tt.b); got != tt.wantEqual { t.Errorf("Results() = %v, want %v", got, tt.wantEqual) } diff --git a/cmd/internal/scdiff/app/format/format_test.go b/cmd/internal/scdiff/app/format/format_test.go index 18c69136..f9d11292 100644 --- a/cmd/internal/scdiff/app/format/format_test.go +++ b/cmd/internal/scdiff/app/format/format_test.go @@ -166,6 +166,7 @@ func TestJSON(t *testing.T) { } func Test_normalize_nil_safe(t *testing.T) { + t.Parallel() var x, y *pkg.ScorecardResult Normalize(x) Normalize(y) diff --git a/cmd/internal/scdiff/app/runner/runner_test.go b/cmd/internal/scdiff/app/runner/runner_test.go index 07bfb613..fd79a744 100644 --- a/cmd/internal/scdiff/app/runner/runner_test.go +++ b/cmd/internal/scdiff/app/runner/runner_test.go @@ -25,6 +25,7 @@ import ( ) func TestNew(t *testing.T) { + t.Parallel() r := New(nil) if len(r.enabledChecks) == 0 { t.Errorf("runner has no checks to run: %v", r.enabledChecks) @@ -37,6 +38,7 @@ func TestNew(t *testing.T) { } func TestRunner_Run(t *testing.T) { + t.Parallel() ctrl := gomock.NewController(t) mockRepo := mockrepo.NewMockRepoClient(ctrl) commit := []clients.Commit{{SHA: "foo"}} diff --git a/dependencydiff/dependencydiff_test.go b/dependencydiff/dependencydiff_test.go index 3717371a..80e59c01 100644 --- a/dependencydiff/dependencydiff_test.go +++ b/dependencydiff/dependencydiff_test.go @@ -25,6 +25,7 @@ import ( ) func Test_initRepoAndClientByChecks(t *testing.T) { + t.Parallel() //nolint:govet tests := []struct { name string @@ -57,6 +58,7 @@ func Test_initRepoAndClientByChecks(t *testing.T) { for _, tt := range tests { tt := tt t.Run(tt.name, func(t *testing.T) { + t.Parallel() err := initRepoAndClientByChecks(&tt.dCtx, tt.srcRepo) if (err != nil) != tt.wantErr { t.Errorf("initClientByChecks() error = {%v}, want error: %v", err, tt.wantErr) @@ -83,6 +85,7 @@ func Test_initRepoAndClientByChecks(t *testing.T) { } func Test_getScorecardCheckResults(t *testing.T) { + t.Parallel() tests := []struct { name string dCtx dependencydiffContext @@ -102,6 +105,7 @@ func Test_getScorecardCheckResults(t *testing.T) { for _, tt := range tests { tt := tt t.Run(tt.name, func(t *testing.T) { + t.Parallel() err := getScorecardCheckResults(&tt.dCtx) if (err != nil) != tt.wantErr { t.Errorf("getScorecardCheckResults() error = {%v}, want error: %v", err, tt.wantErr) @@ -112,6 +116,7 @@ func Test_getScorecardCheckResults(t *testing.T) { } func Test_mapDependencyEcosystemNaming(t *testing.T) { + t.Parallel() //nolint:govet tests := []struct { name string @@ -167,6 +172,7 @@ func Test_mapDependencyEcosystemNaming(t *testing.T) { for _, tt := range tests { tt := tt t.Run(tt.name, func(t *testing.T) { + t.Parallel() err := mapDependencyEcosystemNaming(tt.deps) if tt.errWanted != nil && errors.Is(tt.errWanted, err) { t.Errorf("not a wanted error, want:%v, got:%v", tt.errWanted, err) @@ -177,6 +183,7 @@ func Test_mapDependencyEcosystemNaming(t *testing.T) { } func Test_isSpecifiedByUser(t *testing.T) { + t.Parallel() tests := []struct { name string ct pkg.ChangeType @@ -214,6 +221,7 @@ func Test_isSpecifiedByUser(t *testing.T) { for _, tt := range tests { tt := tt t.Run(tt.name, func(t *testing.T) { + t.Parallel() result := isSpecifiedByUser(tt.ct, tt.changeTypesToCheck) if result != tt.resultWanted { t.Errorf("result (%v) != result wanted (%v)", result, tt.resultWanted) diff --git a/e2e/e2e_suite_test.go b/e2e/e2e_suite_test.go index efe1125a..e1f59f2e 100644 --- a/e2e/e2e_suite_test.go +++ b/e2e/e2e_suite_test.go @@ -25,6 +25,7 @@ import ( "github.com/ossf/scorecard/v4/log" ) +//nolint:paralleltest // avoiding parallel e2e tests due to rate limit concerns (#2527) func TestE2e(t *testing.T) { if val, exists := os.LookupEnv("SKIP_GINKGO"); exists && val == "1" { t.Skip() diff --git a/errors/internal_test.go b/errors/internal_test.go index b1ea3b74..e83c3dd0 100644 --- a/errors/internal_test.go +++ b/errors/internal_test.go @@ -21,6 +21,7 @@ import ( ) func TestCreateInternal(t *testing.T) { + t.Parallel() type args struct { e error msg string @@ -39,6 +40,7 @@ func TestCreateInternal(t *testing.T) { } t.Run(test.name, func(t *testing.T) { + t.Parallel() if got := CreateInternal(test.args.e, test.args.msg); got.Error() != test.want.Error() { t.Errorf("CreateInternal() = %v, want %v", got, test.want) } diff --git a/pkg/json_raw_results_test.go b/pkg/json_raw_results_test.go index 7b489c32..d9391c8c 100644 --- a/pkg/json_raw_results_test.go +++ b/pkg/json_raw_results_test.go @@ -472,6 +472,7 @@ func TestJsonScorecardRawResult_AddMaintainedRawResults(t *testing.T) { } func TestSetDefaultCommitData(t *testing.T) { + t.Parallel() // Define some test data. changesets := []checker.Changeset{ { @@ -657,6 +658,7 @@ func TestJsonScorecardRawResult_AddCodeReviewRawResults(t *testing.T) { } func TestAddCodeReviewRawResults(t *testing.T) { + t.Parallel() r := &jsonScorecardRawResult{} cr := &checker.CodeReviewData{ DefaultBranchChangesets: []checker.Changeset{ @@ -729,6 +731,7 @@ func TestAddCodeReviewRawResults(t *testing.T) { } func TestAddLicenseRawResults(t *testing.T) { + t.Parallel() // Create a new jsonScorecardRawResult instance r := &jsonScorecardRawResult{} @@ -793,6 +796,7 @@ func TestAddLicenseRawResults(t *testing.T) { } func TestAddBinaryArtifactRawResults(t *testing.T) { + t.Parallel() r := &jsonScorecardRawResult{} ba := &checker.BinaryArtifactData{ Files: []checker.File{ @@ -831,6 +835,7 @@ func TestAddBinaryArtifactRawResults(t *testing.T) { } func TestAddSecurityPolicyRawResults(t *testing.T) { + t.Parallel() r := &jsonScorecardRawResult{} sp := &checker.SecurityPolicyData{ PolicyFiles: []checker.SecurityPolicyFile{ @@ -917,6 +922,7 @@ func TestAddSecurityPolicyRawResults(t *testing.T) { } func TestAddVulnerabilitiesRawResults(t *testing.T) { + t.Parallel() r := &jsonScorecardRawResult{} vd := &checker.VulnerabilitiesData{ Vulnerabilities: []clients.Vulnerability{ @@ -955,6 +961,7 @@ func TestAddVulnerabilitiesRawResults(t *testing.T) { } func TestAddFuzzingRawResults(t *testing.T) { + t.Parallel() r := &jsonScorecardRawResult{} fd := &checker.FuzzingData{ Fuzzers: []checker.Tool{ @@ -1040,6 +1047,7 @@ func TestAddFuzzingRawResults(t *testing.T) { } func TestJsonScorecardRawResult(t *testing.T) { + t.Parallel() // create a new instance of jsonScorecardRawResult r := &jsonScorecardRawResult{} @@ -1225,6 +1233,7 @@ func intPtr(i int32) *int32 { } func TestScorecardResult_AsRawJSON(t *testing.T) { + t.Parallel() type fields struct { Repo RepoInfo Date time.Time @@ -1254,6 +1263,7 @@ func TestScorecardResult_AsRawJSON(t *testing.T) { for _, tt := range tests { tt := tt // capture range variable t.Run(tt.name, func(t *testing.T) { + t.Parallel() r := &ScorecardResult{ Repo: tt.fields.Repo, Date: tt.fields.Date, @@ -1343,6 +1353,7 @@ func TestAddBranchProtectionRawResults(t *testing.T) { } func TestFillJSONRawResults(t *testing.T) { + t.Parallel() raw := checker.RawResults{ LicenseResults: checker.LicenseData{ LicenseFiles: []checker.LicenseFile{ diff --git a/pkg/pkg_suite_test.go b/pkg/pkg_suite_test.go index c89786b1..1e143d76 100644 --- a/pkg/pkg_suite_test.go +++ b/pkg/pkg_suite_test.go @@ -22,6 +22,7 @@ import ( . "github.com/onsi/gomega" ) +//nolint:paralleltest // avoiding parallel e2e tests due to rate limit concerns (#2527) func TestPkg(t *testing.T) { if val, exists := os.LookupEnv("SKIP_GINKGO"); exists && val == "1" { t.Skip() diff --git a/policy/policy_test.go b/policy/policy_test.go index 5fec445f..7c77f230 100644 --- a/policy/policy_test.go +++ b/policy/policy_test.go @@ -137,6 +137,7 @@ func TestPolicyRead(t *testing.T) { } func TestChecksHavePolicies(t *testing.T) { + t.Parallel() // Create a sample ScorecardPolicy sp := &ScorecardPolicy{ Version: 1,