Skip to content

Stabilize Mocha outbox registration test against EF provider warning#9937

Merged
glen-84 merged 2 commits into
mainfrom
gai/stabilize-mocha-outbox-registration-test
Jun 17, 2026
Merged

Stabilize Mocha outbox registration test against EF provider warning#9937
glen-84 merged 2 commits into
mainfrom
gai/stabilize-mocha-outbox-registration-test

Conversation

@glen-84

@glen-84 glen-84 commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary

  • OutboxServiceRegistrationTests built its DbContext without suppressing EF Core's ManyServiceProvidersCreatedWarning, unlike the sibling integration test classes in the same assembly. EF Core escalates that warning to an exception once more than 20 internal service providers accumulate in its process-wide cache, so the test threw non-deterministically depending on test ordering and parallelism (it failed one CI run, then passed on re-run).
  • Add .ConfigureWarnings(w => w.Ignore(CoreEventId.ManyServiceProvidersCreatedWarning)) to the test's AddDbContext call, matching the pattern already used by PostgresOutboxIntegrationTests and PostgresSchedulingIntegrationTests.

Test plan

  • dotnet build src/Mocha/test/Mocha.EntityFrameworkCore.Postgres.Tests → 0 warnings, 0 errors
  • dotnet test --filter-class ...OutboxServiceRegistrationTests → 4/4 passed

Copilot AI review requested due to automatic review settings June 17, 2026 10:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Stabilizes Mocha’s Postgres outbox service registration tests by aligning EF Core DbContext configuration with the existing integration tests to avoid nondeterministic failures caused by EF Core’s internal service provider cache warning being escalated to an exception.

Changes:

  • Suppress EF Core ManyServiceProvidersCreatedWarning in OutboxServiceRegistrationTests by configuring EF warnings on the DbContext registration.
  • Add the required EF Core diagnostics import to reference CoreEventId.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-code-quality

github-code-quality Bot commented Jun 17, 2026

Copy link
Copy Markdown

Code Coverage Overview

Languages: C#

C# / code-coverage/dotnet

The overall coverage in the branch remains at 49%, unchanged from the branch.

Show a code coverage summary of the most impacted files.
File 3440480 a5c69b2 +/-
/home/runner/wo...gerMessage.g.cs 19% 15% -4%
/home/runner/wo...PromiseCache.cs 81% 78% -3%
/home/runner/wo...geDispatcher.cs 77% 75% -2%
/home/runner/wo...tocolHandler.cs 81% 82% +1%
/home/runner/wo...DefaultTopic.cs 89% 90% +1%
/home/runner/wo...tor/Mediator.cs 89% 91% +2%
/home/runner/wo.../PingPongJob.cs 80% 83% +3%
/home/runner/wo...entsListener.cs 62% 66% +4%
/home/runner/wo...ewareFactory.cs 95% 100% +5%
/home/runner/wo...gerMessage.g.cs 19% 28% +9%

Updated June 17, 2026 10:58 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants