Skip to content

test(mcp): assert smoke harness connectivity deterministically - #1832

Open
Aaronontheweb wants to merge 4 commits into
devfrom
fix/mcp-smoke-harness-connected
Open

test(mcp): assert smoke harness connectivity deterministically#1832
Aaronontheweb wants to merge 4 commits into
devfrom
fix/mcp-smoke-harness-connected

Conversation

@Aaronontheweb

Copy link
Copy Markdown
Collaborator

Fixes the Windows CI flake in SmokeMcpServerHttpHeaderTests. The failing test asserted tool registration with a bare null check that hid the underlying connect failure.

McpClientManager.StartAsync awaits the whole connect attempt. When it returns, the manager has either published tools to the registry or recorded a failure status with the real error message. The tests never checked that status. An intermittent Windows connect failure surfaced as Assert.NotNull() Failure: Value is null at the tool lookup instead of the actual error. The same test passed on Ubuntu and macOS.

Changes

  • Add McpSmokeHarness.AssertConnected, which asserts the server reached Connected state and fails with the manager's stored error message.
  • Call it after StartAsync in all four header smoke tests.

The assertion is deterministic. It reads a completion signal that already exists — no polling, no timeout adjustments. When the server fails to connect, the test now reports the connect error instead of a null.

Verified locally: all 4 SmokeMcpServerHttpHeaderTests pass; the Daemon.Tests project builds with 0 warnings.

StartAsync awaits the whole connect attempt, so by the time it returns
the manager has either published tools to the registry or recorded a
failure status with the underlying error message. Asserting Connected
via GetServerStatuses() turns an intermittent Windows CI connect failure
(previously a bare Assert.NotNull null on the tool lookup in
SmokeMcpServerHttpHeaderTests) into a failure that names the real error,
instead of silently swallowing it.
Wire the McpClientManager logger to xunit test output in the HTTP smoke
harness. ReportConnectionFailure logs the full exception, but NullLogger
discarded it — the tests only ever saw the generic 'Failed to reach MCP
server' status message. On the intermittent Windows connect flake, this
now prints the underlying exception to the CI log so the root cause can
be fixed precisely instead of guessed.

@Aaronontheweb Aaronontheweb left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

LGTM

@Aaronontheweb Aaronontheweb added mcp Model context protocol server / client issues. tests All issues related to testing, quality assurance, and smoke testing. bug Something isn't working labels Aug 9, 2026
@Aaronontheweb
Aaronontheweb enabled auto-merge (squash) August 9, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working mcp Model context protocol server / client issues. tests All issues related to testing, quality assurance, and smoke testing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant