Add In-Process backend for E2E testing#113
Add In-Process backend for E2E testing#113andystaples wants to merge 9 commits intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new in-process, in-memory gRPC backend (durabletask.testing) intended to replace the external durabletask-go sidecar dependency for core durabletask end-to-end tests, and updates CI/docs accordingly.
Changes:
- Added
InMemoryOrchestrationBackendpluscreate_test_backend()factory underdurabletask/testing/. - Updated/added core
tests/durabletask/*E2E-style tests to run against the in-process backend (including batch actions and entity scenarios). - Simplified developer + CI test execution (Makefile/docs/workflow) by removing sidecar setup.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/durabletask/test_orchestration_versioning_e2e.py | Switches versioning E2E test to in-process backend and explicit host/port. |
| tests/durabletask/test_orchestration_e2e.py | Switches orchestration E2E tests to in-process backend and explicit host/port; adjusts suspend waiting. |
| tests/durabletask/test_in_memory_backend_entities.py | Adds entity-focused tests against the in-memory backend. |
| tests/durabletask/test_in_memory_backend.py | Adds basic orchestration/activity/timer/sub-orchestration tests against the in-memory backend. |
| tests/durabletask/test_batch_actions.py | Implements batch query/purge/entity query tests using the in-memory backend. |
| tests/durabletask/entities/test_function_based_entities_e2e.py | Adds function-based entity E2E tests using the in-memory backend. |
| tests/durabletask/entities/test_entity_failure_handling.py | Adds entity failure-handling E2E tests using the in-memory backend. |
| tests/durabletask/entities/test_class_based_entities_e2e.py | Adds class-based entity E2E tests using the in-memory backend. |
| tests/durabletask/entities/init.py | Marks the new entities test package. |
| pyproject.toml | Removes the prior e2e marker configuration. |
| examples/in_memory_backend_example.py | Adds a runnable example showing how to use the in-memory backend. |
| durabletask/testing/in_memory_backend.py | Implements the in-memory gRPC backend and create_test_backend() helper. |
| durabletask/testing/init.py | Exposes InMemoryOrchestrationBackend and create_test_backend as public testing utilities. |
| durabletask/testing/README.md | Documents testing utilities and the in-memory backend usage. |
| docs/development.md | Updates dev instructions to run tests without a sidecar. |
| Makefile | Collapses test-unit/test-e2e into a single test target. |
| .github/workflows/durabletask.yml | Removes Go sidecar installation and runs core tests without sidecar. |
halspang
left a comment
There was a problem hiding this comment.
Overall, I think this looks pretty good! I have a few questions/comments.
| from durabletask.worker import TaskHubGrpcWorker | ||
|
|
||
|
|
||
| def main(): |
There was a problem hiding this comment.
Would it be possible (or correct by python standards) to separate the orchestrations from this file? I would love to show what it would look like for someone who is using this SDK to develop an orchestration use this as a test host.
| instance_id: str | ||
| name: str | ||
| task_id: int | ||
| input: Optional[str] | ||
| completion_token: int |
There was a problem hiding this comment.
Same here, activities can be versioned too.
There was a problem hiding this comment.
Although activities can be versioned in DTS and other backends, this SDK does not provide support for activity versioning yet. I'd prefer adding support for this feature to the in-memory backend when the feature is implemented into the SDK
|
|
||
| # Process actions | ||
| for action in request.actions: | ||
| self._process_action(instance, action) |
There was a problem hiding this comment.
Can this raise an exception and if so, would it orphan the orchestration since we wouldn't update _orchestration_in_flight or _notify_waiters?
| if not entity: | ||
| self._logger.warning( | ||
| f"No entity found for completion token '{request.completionToken}'" | ||
| ) | ||
| return pb.CompleteTaskResponse() |
There was a problem hiding this comment.
Does this state signify anything and would we need to potentially clean up something? Or can we not know since the completion token isn't valid anymore?
| self._state_waiters[instance_id].append(waiter) | ||
|
|
||
| # Wait outside the lock | ||
| wait_result = waiter.event.wait(timeout=timeout if timeout else 30.0) |
There was a problem hiding this comment.
I didn't think the other wait methods had a default timeout, they just wait forever?
Adds a fully-featured in-memory Durable backend for E2E testing. Removes the previous dependency on the durabletask-go sidecar. Implement missing tests for
durabletaskincluding tests for batch actions, entities, and versioning.