Skip to content

fix(coderd): isolate OIDC fake IDP in parallel subtests#26075

Merged
ibetitsmike merged 1 commit into
mainfrom
eng-2833-race-flake
Jun 4, 2026
Merged

fix(coderd): isolate OIDC fake IDP in parallel subtests#26075
ibetitsmike merged 1 commit into
mainfrom
eng-2833-race-flake

Conversation

@ibetitsmike
Copy link
Copy Markdown
Collaborator

@ibetitsmike ibetitsmike commented Jun 4, 2026

ENG-2833 reported TestPatchChat/PlanMode/* and TestProvisionerJobs/ProvisionerJobs/Single/* as race failures. Re-fetching the full job log showed those tests only had testing.go:1712: race detected during execution of test after the package-level race detector had already reported stacks from TestUserOIDC/OIDCEmailFallbackBlockedByExistingLink.

The race stack reads oauth2.Config.AuthCodeURL through coderd/httpmw/oauth2.go while another parallel OIDC subtest writes the same fake IDP redirect URL through oidctest.FakeIDP.SetRedirect. This moves the oidctest.FakeIDP setup into each parallel table subtest so plan chat and provisioner job tests are no longer collateral failures from the shared OIDC fake.

Closes ENG-2833

Coder Agents generated context

Generated by Coder Agents.

Relevant original CI log evidence:

  • WARNING: DATA RACE at lines 1515, 1737, 1965, and 2193 of the fetched job log.
  • Read side: golang.org/x/oauth2.(*Config).AuthCodeURL() through coderd/httpmw/oauth2.go:156.
  • Write side: coderd/coderdtest/oidctest.(*FakeIDP).SetRedirect() from LoginWithClient() in TestUserOIDC/OIDCEmailFallbackBlockedByExistingLink.
  • Later failures in TestPatchChat/PlanMode/* and TestProvisionerJobs/ProvisionerJobs/Single/* only contain testing.go:1712: race detected during execution of test.

Local validation:

  • go test -race ./coderd -run 'TestUserOIDC/OIDCEmailFallbackBlockedByExistingLink' -count=50 -failfast -v
  • go test -race ./coderd -run '^(TestUserOIDC|TestPatchChat|TestProvisionerJobs)$/((OIDCEmailFallbackBlockedByExistingLink)|(PlanMode|Title)|(ProvisionerJobs))' -count=20 -failfast
  • make lint

@linear-code
Copy link
Copy Markdown

linear-code Bot commented Jun 4, 2026

ENG-2833

@ibetitsmike ibetitsmike marked this pull request as ready for review June 4, 2026 21:02
@ibetitsmike ibetitsmike merged commit 242c4d7 into main Jun 4, 2026
59 checks passed
@ibetitsmike ibetitsmike deleted the eng-2833-race-flake branch June 4, 2026 21:03
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants