Skip to content

Conversation

MackinnonBuck
Copy link
Member

No description provided.

@github-actions github-actions bot added the area-identity Includes: Identity and providers label Oct 13, 2025
@MackinnonBuck
Copy link
Member Author

Worked once, but this is a flaky test. Re-running to validate that this is really fixed.

@MackinnonBuck
Copy link
Member Author

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@BrennanConroy
Copy link
Member

Worked once, but this is a flaky test. Re-running to validate that this is really fixed.

Is it flaky locally? Try adding [Repeat(1000)] to the test and seeing if it fails.

@MackinnonBuck
Copy link
Member Author

MackinnonBuck commented Oct 14, 2025

Worked once, but this is a flaky test. Re-running to validate that this is really fixed.

Is it flaky locally? Try adding [Repeat(1000)] to the test and seeing if it fails.

I haven't been able to reproduce the failure consistently locally, even with "Run until failure". I think I've only seen it fail locally one time.

@MackinnonBuck MackinnonBuck marked this pull request as ready for review October 14, 2025 23:54
@Copilot Copilot AI review requested due to automatic review settings October 14, 2025 23:54
Copy link
Contributor

@Copilot 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 the UserStoreTest class by introducing a dedicated test-specific DbContext class to replace direct usage of the generic IdentityDbContext. The changes ensure proper type safety and consistency throughout the test suite.

  • Introduces UserStoreTestDbContext as a dedicated test context class
  • Replaces all IdentityDbContext references with the new UserStoreTestDbContext
  • Updates method signatures and generic type parameters consistently

@MackinnonBuck
Copy link
Member Author

I believe the culprit was that EF Core caches compiled models per DbContext type. Multiple test classes were using the base IdentityDbContext type with different IdentitySchemaVersions configurations (including UserStoreTest). When tests ran in parallel, the first test would cache a model with its schema version, and subsequent tests would reuse that model regardless of their configuration. If a test with the default schema (Version1, no passkey support) ran first, later tests expecting Version3 would fail. I fixed this by using a UserStoreTestDbContext type instead of the shared IdentityDbContext, which matches the pattern already used by some of the other test files.

@ilonatommy
Copy link
Member

Is it ready? Before I noticed this fix attempt, I opened #64056, #64055 to quarantine them because they blocks the pipeline.

@MackinnonBuck
Copy link
Member Author

@ilonatommy this PR is ready. Just needs an approval.

@MackinnonBuck MackinnonBuck merged commit c299d9c into main Oct 15, 2025
30 checks passed
@MackinnonBuck MackinnonBuck deleted the mbuck/fix-userstore-tests branch October 15, 2025 16:29
@dotnet-policy-service dotnet-policy-service bot added this to the 11.0-preview1 milestone Oct 15, 2025
MackinnonBuck added a commit that referenced this pull request Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-identity Includes: Identity and providers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants