Skip to content

Add In-Process backend for E2E testing#113

Open
andystaples wants to merge 9 commits intomicrosoft:mainfrom
andystaples:andystaples/add-inprocess-test-backend
Open

Add In-Process backend for E2E testing#113
andystaples wants to merge 9 commits intomicrosoft:mainfrom
andystaples:andystaples/add-inprocess-test-backend

Conversation

@andystaples
Copy link
Contributor

Adds a fully-featured in-memory Durable backend for E2E testing. Removes the previous dependency on the durabletask-go sidecar. Implement missing tests for durabletask including tests for batch actions, entities, and versioning.

Copy link
Contributor

Copilot AI left a comment

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 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 InMemoryOrchestrationBackend plus create_test_backend() factory under durabletask/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.

Copy link
Member

@halspang halspang left a comment

Choose a reason for hiding this comment

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

Overall, I think this looks pretty good! I have a few questions/comments.

from durabletask.worker import TaskHubGrpcWorker


def main():
Copy link
Member

Choose a reason for hiding this comment

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

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.

Comment on lines +53 to +57
instance_id: str
name: str
task_id: int
input: Optional[str]
completion_token: int
Copy link
Member

Choose a reason for hiding this comment

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

Same here, activities can be versioned too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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)
Copy link
Member

Choose a reason for hiding this comment

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

Can this raise an exception and if so, would it orphan the orchestration since we wouldn't update _orchestration_in_flight or _notify_waiters?

Comment on lines +651 to +655
if not entity:
self._logger.warning(
f"No entity found for completion token '{request.completionToken}'"
)
return pb.CompleteTaskResponse()
Copy link
Member

Choose a reason for hiding this comment

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

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)
Copy link
Member

Choose a reason for hiding this comment

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

I didn't think the other wait methods had a default timeout, they just wait forever?

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.

3 participants