Skip to content

Fix NetMQ tests failing when run together - #80

Closed
christopherread wants to merge 1 commit into
masterfrom
fix/netmq-test-ports
Closed

christopherread wants to merge 1 commit into
masterfrom
fix/netmq-test-ports

Conversation

@christopherread

Copy link
Copy Markdown
Owner

Fixes #72.

Cause

  • Shared ports: two TestPublishSubscribe tests both used port 5556, and the third used 5557. TestServiceBusWithNetMq's endpoint on port 5555 binds 5555–5558 (one port per message kind), and xUnit runs the two classes in parallel.
  • Nothing disposed: no test disposed its publishers, sources or service buses, so sockets stayed bound for the next test.

Fix

  • Each pub/sub test gets its own port (5560, 5561, 5562).
  • Every test disposes its publishers, sources and buses before asserting, so a failed assertion can't leave sockets bound.

Only test code changes.

Testing

  • Before: run together, the same 3 of 4 tests failed every time (2 runs).
  • After: all 4 pass together, 8 runs in a row.
  • They're still Explicit, so CI doesn't run them yet; Run broker-backed transport tests in CI #74 covers that.

🤖 Generated with Claude Code

The pub/sub tests shared port 5556 between themselves and overlapped the
5555-5558 range TestServiceBusWithNetMq binds, which xUnit runs in
parallel, and no test disposed its publishers, sources or buses. Give
each pub/sub test its own port and dispose everything before asserting.

Fixes #72

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
christopherread added a commit that referenced this pull request Oct 25, 2026
Master now runs tests on Microsoft.Testing.Platform (#101), so use
--project and --filter-trait. The NetMQ tests no longer clash over ports
(#80), so run them too. The broker steps now come before the unit test
step, so this branch no longer edits the lines master changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
christopherread added a commit that referenced this pull request Oct 25, 2026
Master now runs tests on Microsoft.Testing.Platform (#101), so use
--project and --filter-trait. The NetMQ tests no longer clash over ports
(#80), so run them too. The broker steps now come before the unit test
step, so this branch no longer edits the lines master changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@christopherread

Copy link
Copy Markdown
Owner Author

Included in #101, which merged these commits into master (fixes #72).

@christopherread
christopherread deleted the fix/netmq-test-ports branch October 25, 2026 23:01
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.

Fix NetMQ tests failing when run together (shared ports)

1 participant