-
Notifications
You must be signed in to change notification settings - Fork 618
Fix OIDC provider initialization causing unit test timeouts in Kubernetes CI #8844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: intojhanurag The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
It is not ready for review . I am testing something. I will convert in draft in some time . |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8844 +/- ##
==========================================
- Coverage 51.12% 51.09% -0.04%
==========================================
Files 409 409
Lines 21369 21383 +14
==========================================
Hits 10925 10925
- Misses 9592 9606 +14
Partials 852 852 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
||
| // provider is valid, update it | ||
| v.m.Lock() | ||
| defer v.m.Unlock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the lock from initOIDCProvider() because the caller now holds the lock.
Fixes #8314
Proposed Changes
Root Cause: The
auth.NewVerifier()constructor eagerly initialized the OIDC provider by making HTTP calls tohttps://kubernetes.default.svc/.well-known/openid-configuration. In Kubernetes environments, DNS resolution succeeds but HTTP requests hang, blocking test execution. Locally, DNS resolution fails quickly and tests pass.This violated unit test isolation by making real network calls during object construction, creating environment-dependent test behavior.
Solution
Implemented lazy initialization of the OIDC provider:
ensureProvider()method using double-checked locking pattern for thread-safe lazy initializationensureProvider()before performing authenticationModified Files
Pre-review Checklist
Release Note