Replace fixed test ports with free port helper#157
Merged
berndverst merged 4 commits intoJun 25, 2026
Conversation
Contributor
There was a problem hiding this comment.
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. |
berndverst
approved these changes
Jun 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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