Repository navigation
lint: re-enable paralleltest - #915
Merged
Merged
Conversation
Signed-off-by: Carlos Panato <ctadeu@gmail.com>
Member
Author
|
@jeffmendoza PTAL |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the test-parallelization and linter changes.
No open issues 🎉
What changed in this PR
Re-enables paralleltest as part of #716, allowing independent tests to run concurrently while keeping shared-state tests serial. Production code is unchanged.
Changes:
- Enables parallel execution for ten top-level tests and their independent subtests.
- Isolates configuration mocks and cache keys, and adds fixture cleanup to address test-order dependencies.
- Adds function-scoped linter exemptions explaining why shared-state tests remain serial.
| File | Description |
|---|---|
pkg/scorecard/scorecard_test.go |
Documents serial execution for shared client factories and cache. |
pkg/policies/workflow/workflow_test.go |
Exempts the shared configuration-mock test. |
pkg/policies/security/security_test.go |
Exempts tests sharing GraphQL and configuration mocks. |
pkg/policies/scorecard/scorecard_test.go |
Exempts tests sharing Scorecard and configuration mocks. |
pkg/policies/scorecard/sarif_test.go |
Parallelizes compression testing; exempts shared upload-state tests. |
pkg/policies/outside/outside_test.go |
Exempts tests sharing collaborator and configuration mocks. |
pkg/policies/codeowners/codeowners_test.go |
Exempts tests sharing Codeowners and configuration mocks. |
pkg/policies/branch/branch_test.go |
Exempts tests sharing branch-protection and configuration mocks. |
pkg/policies/binary/binary_test.go |
Exempts the shared configuration-mock test. |
pkg/policies/admin/admin_test.go |
Exempts tests sharing collaborator and configuration mocks. |
pkg/policies/action/action_test.go |
Parallelizes independent tests; exempts shared-mock checks. |
pkg/issue/issue_test.go |
Resets and restores the schedule mock; documents serial tests. |
pkg/ghclients/ghclients_test.go |
Adds per-test transport setup and shared-state restoration. |
pkg/enforce/enforce_test.go |
Exempts tests sharing policy and GitHub mocks. |
pkg/config/schedule/schedule_test.go |
Parallelizes merge tests; exempts the shared-clock test. |
pkg/config/operator/operator_test.go |
Parallelizes independent tests; exempts global-state mutations. |
pkg/config/config_test.go |
Makes mocks instance-local, isolates cache keys, and parallelizes independent tests. |
.golangci.yml |
Re-enables paralleltest. |
Review effort: Balanced
jeffmendoza
marked this pull request as ready for review
November 7, 2026 04:28
jeffmendoza
approved these changes
Nov 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Re-enable
paralleltestand run ten independent top-level tests, along with their independent subtests, in parallel. Repository mocks in the configuration tests now belong to individual test instances, and the installation-cache test uses its own cache keys and cleans them up.Tests that replace package-level mocks, write configuration globals or the glob cache, or manipulate shared client state remain serial with function-scoped
nolint:paralleltestdirectives explaining the shared state. No file-wide or global exclusions are added.Fix test-order dependencies exposed by shuffled runs: reset the issue schedule mock, restore configuration lookup mocks and cache entries, and give each GitHub-client test its own transport setup with cleanup. Production code is unchanged.
Part of #716.
Validation:
go test -race -shuffle=on -count=3 ./...passed.go test -race -shuffle=on -count=5 ./pkg/ghclientspassed after the final fixture cleanup.golangci-lint run --timeout 5m ./...passed with zero issues (local v2.15.0).git diff --checkpassed.