Skip to content

test(testing): cover TestingHost failure diagnostics - #10883

Merged
ReubenBond merged 2 commits into
dotnet:mainfrom
ReubenBond:rb-test-testinghost-testkit-coverage
Aug 28, 2026
Merged

ReubenBond merged 2 commits into
dotnet:mainfrom
ReubenBond:rb-test-testinghost-testkit-coverage

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Aug 28, 2026 •

Copy link
Copy Markdown
Member

Problem

Orleans.TestingHost lifecycle, logging, and diagnostic infrastructure has significant uncovered failure paths, making regressions in cleanup and failure evidence difficult to detect.

Solution

  • Add deterministic in-process cluster tests for silo startup, client startup, and silo stop failures, including exact cleanup and retained diagnostics.
  • Cover in-memory logging across nested, aggregate, and loader exceptions; filtering, scopes, concurrent collection, disposal, truncation, and UTF-8 sizing.
  • Cover diagnostic event filtering, historical and future waits, predicates, timeout messages, clearing, and disposal.
  • Pin Reminder TestKit failure-report placeholders and exception propagation.

Coverage impact

Target Before After
Orleans.TestingHost 30.70% line / 24.20% branch 48.39% line / 39.63% branch
InProcTestCluster.cs 0% / 0% 50.41% / 40.67%
InMemoryLoggerProvider.cs 0% / 0% 80.86% / 71.93%
PrintException 0% / 0% 84.44% / 80.77%
DiagnosticEventCollector.cs 0% / 0% 90.34% / 75.00%
ReminderTestKitDiagnostics.cs 87.76% line / 75.00% branch 87.76% line / 100.00% branch

This is a mergeable first slice toward #10864. Storage emulator modernization and the remaining package-wide coverage gap remain follow-up work.

Microsoft Reviewers: Open in CodeFlow

Copilot AI lite review requested due to automatic review settings August 28, 2026 01:35

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.

Copilot review overview

Review tier: Lite
Findings: 1 High severity

New issues introduced by this change (1)
Severity Finding
High severity test/​Orleans.Reminders.TestKit.Tests/​ReminderTestKitDiagnosticsTests.cs — The test file uses TestExtensions attributes (TestSuite/TestProvider/TestArea/TestCategory) but…
What changed in this PR

This PR adds deterministic tests to increase coverage of Orleans.TestingHost lifecycle failure handling and diagnostic utilities, plus a small set of tests to pin Orleans.Reminders.TestKit failure-report behavior. It aligns with the incremental coverage goals in #10864 by asserting cleanup/idempotency and the exact diagnostic evidence retained on failure.

Changes:

  • Add in-process cluster lifecycle tests which simulate silo startup failure, client startup failure, and silo stop failure, asserting cleanup + retained diagnostics.
  • Add comprehensive InMemoryLoggerProvider/InMemoryLogBuffer tests for exception formatting, filtering, scopes, concurrency, disposal, truncation/byte sizing, and diagnostics output.
  • Add DiagnosticEventCollector tests covering listener filtering, historical vs future waits, predicates, timeout messaging, clearing, and disposal behavior.
File Description
test/​TestInfrastructure/​Orleans.TestingHost.Tests/​InProcessTestClusterLifecycleTests.cs New functional tests for in-proc cluster failure paths and disposal/diagnostics behavior.
test/​TestInfrastructure/​Orleans.TestingHost.Tests/​InMemoryLoggerProviderTests.cs New BVT tests validating in-memory logging behavior, formatting, filtering, concurrency, and disposal semantics.
test/​TestInfrastructure/​Orleans.TestingHost.Tests/​DiagnosticEventCollectorTests.cs New BVT tests for diagnostic listener filtering and event waiting/counting behaviors.
test/​Orleans.Reminders.TestKit.Tests/​ReminderTestKitDiagnosticsTests.cs New tests pinning reminder failure report placeholders and exception propagation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Code coverage

78.67% line coverage - 99,604 / 126,605 lines

Coverage details

Copilot AI review requested due to automatic review settings August 28, 2026 04:04

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.

Copilot review overview

Review tier: Lite
Findings: None

Issues resolved since last review (1)
Severity Finding
High severity test/​Orleans.Reminders.TestKit.Tests/​ReminderTestKitDiagnosticsTests.cs — The test file uses TestExtensions attributes (TestSuite/TestProvider/TestArea/TestCategory) but… View resolved comment
Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

test/TestInfrastructure/Orleans.TestingHost.Tests/InProcessTestClusterLifecycleTests.cs:429

  • FixedPortAllocator returns hard-coded port ranges (20k/30k) instead of probing for free ports and it ignores the numPorts contract. This can make the new lifecycle tests flaky on shared CI agents when those ports are already in use (startup would fail for the wrong reason).

Consider delegating to the existing TestClusterPortAllocator (which finds unused ports) while still tracking AllocationRequests/DisposeCount.

        public (int, int) AllocateConsecutivePortPairs(int numPorts)
        {
            _allocationRequests.Enqueue(numPorts);
            var pair = Interlocked.Increment(ref _nextPortPair);
            return (20_000 + pair, 30_000 + pair);

@ReubenBond
ReubenBond merged commit cb2a52e into dotnet:main Aug 28, 2026
139 of 141 checks passed
@ReubenBond
ReubenBond deleted the rb-test-testinghost-testkit-coverage branch August 28, 2026 06:48
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants