Skip to content

Replace fixed test ports with free port helper#157

Merged
berndverst merged 4 commits into
microsoft:mainfrom
andystaples:andystaples/cleanup-test-ports
Jun 25, 2026
Merged

Replace fixed test ports with free port helper#157
berndverst merged 4 commits into
microsoft:mainfrom
andystaples:andystaples/cleanup-test-ports

Conversation

@andystaples

Copy link
Copy Markdown
Contributor

Replaces fixed port numbers used by the unit tests and in-memory backend to use a shared helper that finds a free port - minimizing flaky test failures and Windows Hyper-V port conflict issues

Copilot AI review requested due to automatic review settings June 25, 2026 16:52

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

This PR updates the Durable Task Python SDK test suite to stop relying on hard-coded localhost ports, instead selecting an available port at runtime via a shared helper. This reduces flaky failures caused by port collisions (notably on Windows where reserved port ranges can conflict with fixed test ports).

Changes:

  • Introduced a shared find_free_port() helper for tests.
  • Updated multiple E2E/integration-style tests to use dynamically selected backend ports instead of fixed values.
  • Updated history-export and entity E2E tests to use the shared port helper.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
tests/durabletask/test_work_item_filters_e2e.py Switches work-item filter E2E backend to a dynamically selected port.
tests/durabletask/test_orchestration_versioning_e2e.py Uses a dynamically selected port for orchestration versioning E2E backend.
tests/durabletask/test_orchestration_e2e.py Uses a dynamically selected port for orchestration E2E backend.
tests/durabletask/test_orchestration_async_e2e.py Uses a dynamically selected port for async orchestration E2E backend.
tests/durabletask/test_large_payload_e2e.py Uses a dynamically selected port for the in-memory backend used in large-payload E2E tests.
tests/durabletask/test_batch_actions.py Uses a dynamically selected port for batch action tests.
tests/durabletask/extensions/history_export/test_orchestrator.py Uses a dynamically selected port for history-export orchestrator E2E backend.
tests/durabletask/extensions/history_export/test_entity.py Uses a dynamically selected port for history-export entity E2E backend.
tests/durabletask/extensions/history_export/test_client.py Uses a dynamically selected port for history-export client E2E backend.
tests/durabletask/extensions/history_export/test_activities.py Uses a dynamically selected port for history-export activities E2E backend.
tests/durabletask/entities/test_function_based_entities_e2e.py Uses a dynamically selected port for function-based entities E2E backend.
tests/durabletask/entities/test_entity_failure_handling.py Uses a dynamically selected port for entity failure handling E2E backend.
tests/durabletask/entities/test_class_based_entities_e2e.py Uses a dynamically selected port for class-based entities E2E backend.
tests/durabletask/_port_utils.py Adds shared helper for choosing a free TCP port for tests.

Comment thread tests/durabletask/test_work_item_filters_e2e.py Outdated
Comment thread tests/durabletask/test_orchestration_versioning_e2e.py Outdated
Comment thread tests/durabletask/test_orchestration_e2e.py Outdated
Comment thread tests/durabletask/test_orchestration_async_e2e.py Outdated
Comment thread tests/durabletask/test_large_payload_e2e.py Outdated
Comment thread tests/durabletask/extensions/history_export/test_orchestrator.py Outdated
Comment thread tests/durabletask/extensions/history_export/test_entity.py Outdated
Comment thread tests/durabletask/extensions/history_export/test_client.py Outdated
Comment thread tests/durabletask/extensions/history_export/test_activities.py Outdated
Comment thread tests/durabletask/_port_utils.py
Comment thread tests/durabletask/_port_utils.py Fixed
@berndverst berndverst merged commit bb721f8 into microsoft:main Jun 25, 2026
17 checks passed
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.

4 participants