Use a frozen clock in the mas-oidc-client integration tests - #5963
Open
barodeur wants to merge 2 commits into
Open
Use a frozen clock in the mas-oidc-client integration tests#5963barodeur wants to merge 2 commits into
mas-oidc-client integration tests#5963barodeur wants to merge 2 commits into
Conversation
The oidc-client integration tests read the real system clock through a `now()` helper. The ID token builder generates a fresh RSA key before stamping `iat`, while each test captured its own `now` earlier for verification. Under coverage instrumentation on a loaded CI runner, the two key generations in `fail_verify_id_token_wrong_auth_time` took more than the 5 minute `iat` leeway, so verification failed on `iat` before ever reaching the `auth_time` check the test asserts on. Make the helper return a frozen `MockClock` timestamp instead. Every token and verification in the binary now shares one instant, so setup duration can no longer affect the outcome, and the clippy opt-out for `Utc::now()` goes away.
barodeur
marked this pull request as ready for review
September 3, 2026 14:34
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.
TLDR: the
mas-oidc-clientintegration tests read the real system clock, which makesfail_verify_id_token_wrong_auth_timefail when the CI runner is slow. Make the tests'now()helper return a fixedMockClocktimestamp instead.Seen on the coverage job of #5961: https://github.com/element-hq/matrix-authentication-service/actions/runs/33742437377/job/100607201186
The proposed solution here is to:
mas-data-modelas a dev-dependency ofmas-oidc-clientnow()returnMockClock::default().now()