Skip to content

fix flaky Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManagerTests.DeleteKeys#65989

Merged
DeagleGross merged 1 commit into
dotnet:mainfrom
DeagleGross:dmkorolev/flaky/xmlkeymanager-deletekeys
Mar 27, 2026
Merged

fix flaky Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManagerTests.DeleteKeys#65989
DeagleGross merged 1 commit into
dotnet:mainfrom
DeagleGross:dmkorolev/flaky/xmlkeymanager-deletekeys

Conversation

@DeagleGross
Copy link
Copy Markdown
Member

The test calls RevokeAllKeys(DateTimeOffset.UtcNow, ...) twice. Both calls can capture the same timestamp. When DeleteKeys runs, it tries to clean up superseded mass-revocations using strict <

I ran the test locally and it failed multiple times before changes, but after it passed 50/50 times

@DeagleGross DeagleGross self-assigned this Mar 26, 2026
@DeagleGross DeagleGross added the area-dataprotection Includes: DataProtection label Mar 26, 2026
Copilot AI review requested due to automatic review settings March 26, 2026 19:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes flakiness in XmlKeyManagerTests.DeleteKeys by removing reliance on DateTimeOffset.UtcNow for key creation/revocation timing, which could previously produce identical timestamps and break strict < comparisons used when cleaning up superseded mass-revocations.

Changes:

  • Replaces UtcNow-based key activation/revocation times with deterministic, fixed “epoch”-relative timestamps.
  • Ensures the two RevokeAllKeys calls use distinct, ordered timestamps so superseded mass revocations are reliably identifiable.

@DeagleGross DeagleGross enabled auto-merge (squash) March 26, 2026 19:31
@DeagleGross
Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

@DeagleGross DeagleGross merged commit 000f79d into dotnet:main Mar 27, 2026
31 checks passed
@dotnet-policy-service dotnet-policy-service Bot added this to the 11.0-preview3 milestone Mar 27, 2026
@wtgodbe wtgodbe modified the milestones: 11.0-preview3, 11.0-preview4 Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-dataprotection Includes: DataProtection

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants