Skip to content

Stabilize logger-based unit tests by enabling fake ILogger in affected suites#1318

Open
Copilot wants to merge 9 commits into
masterfrom
copilot/improve-logging-source-generation
Open

Stabilize logger-based unit tests by enabling fake ILogger in affected suites#1318
Copilot wants to merge 9 commits into
masterfrom
copilot/improve-logging-source-generation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 26, 2026

Recent test failures were caused by log assertions expecting ILogger.Log(...) calls that never fired. The suites were exercising LoggerMessage-generated logging paths, which now gate emission behind ILogger.IsEnabled(...).

  • Root cause addressed

    • Several tests asserted warning/critical log events via FakeItEasy without configuring the fake logger’s IsEnabled behavior.
    • As a result, only IsEnabled(level) was invoked and log assertions failed.
  • Test setup updates

    • Added explicit logger enablement in affected test constructors so log emission paths are exercised.
    • Updated suites include:
      • MigratorTests
      • InvitationEventConsumerTests
      • EmailUserNotificationsTests
  • Behavioral impact

    • No production/runtime logic changes.
    • Test intent remains the same; only fixture setup now matches current logging semantics.
A.CallTo(() => log.IsEnabled(A<LogLevel>._))
    .Returns(true);

Copilot AI changed the title Use source-generated logging in core backend paths Centralize source-generated logging into project-level LogMessages classes (remove EventIds) May 26, 2026
Copilot AI changed the title Centralize source-generated logging into project-level LogMessages classes (remove EventIds) Centralize backend logging messages per project and remove EventId usage May 26, 2026
Copilot AI changed the title Centralize backend logging messages per project and remove EventId usage Centralize Infrastructure/Web ILogger messages into project LogMessages classes (remove EventIds) May 26, 2026
Copilot AI changed the title Centralize Infrastructure/Web ILogger messages into project LogMessages classes (remove EventIds) Extend [LoggerMessage] source generation to all projects using ILogger May 26, 2026
@SebastianStehle SebastianStehle marked this pull request as ready for review May 26, 2026 19:52
Copilot AI changed the title Extend [LoggerMessage] source generation to all projects using ILogger Align MigratorTests with ILogger IsEnabled gating May 26, 2026
Copilot AI changed the title Align MigratorTests with ILogger IsEnabled gating Stabilize logger-based unit tests by enabling fake ILogger in affected suites May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants