Skip to content

lint: re-enable paralleltest - #915

Merged
jeffmendoza merged 1 commit into
ossf:mainfrom
cpanato:lint/re-enable-paralleltest
Nov 7, 2026
Merged

jeffmendoza merged 1 commit into
ossf:mainfrom
cpanato:lint/re-enable-paralleltest

Conversation

@cpanato

@cpanato cpanato commented Nov 6, 2026

Copy link
Copy Markdown
Member

Re-enable paralleltest and 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:paralleltest directives 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/ghclients passed after the final fixture cleanup.
  • golangci-lint run --timeout 5m ./... passed with zero issues (local v2.15.0).
  • git diff --check passed.

Signed-off-by: Carlos Panato <ctadeu@gmail.com>
@cpanato

cpanato commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

@jeffmendoza PTAL

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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
jeffmendoza marked this pull request as ready for review November 7, 2026 04:28
@jeffmendoza
jeffmendoza requested a review from a team as a code owner November 7, 2026 04:28
@jeffmendoza
jeffmendoza merged commit a04c01d into ossf:main Nov 7, 2026
11 checks passed
@cpanato
cpanato deleted the lint/re-enable-paralleltest branch November 7, 2026 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants