fix: early oidc refresh with fake idp tests#22712
Merged
Conversation
This was referenced Mar 6, 2026
johnstcn
reviewed
Mar 6, 2026
| if c.refreshExpected { | ||
| require.Equal(t, 1, tokenRefreshCount) | ||
| } else { | ||
| require.Equal(t, 0, tokenRefreshCount) |
Member
There was a problem hiding this comment.
We need to be able to differentiate between "no calls recorded" versus "no calls attempted"
Member
Author
There was a problem hiding this comment.
If I understand correctly, I think this is kinda done. TestShouldRefreshOIDCToken tests if shouldRefreshOIDCToken returns true/false. Which is the equivalent of "refresh attempted".
Then this more e2e style test with a real idp is checking if the underlying oauth library actually does the refresh.
What I should add is a check for the updated expiration time + access token change on the db row. Which also addresses your comment
Member
Author
There was a problem hiding this comment.
I now check if the token actually changed in the db 👍
johnstcn
approved these changes
Mar 6, 2026
johnstcn
approved these changes
Mar 6, 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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Wrote unit tests that implement a fake idp to verify the oauth package actually refreshes the token