-
Notifications
You must be signed in to change notification settings - Fork 7
add deterministic methods and increase test coverage #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Filinto Duran <[email protected]>
| coverage-clean: | ||
| rm -f .coverage .coverage.* coverage.xml | ||
|
|
||
| coverage-all: coverage-clean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could probably later be moved to tox as a new test option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it be moved now? Or maybe open a separate PR for it?
|
@acroca ptal |
Signed-off-by: Filinto Duran <[email protected]>
| @@ -0,0 +1,74 @@ | |||
| from collections import namedtuple | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cover paths not tested previously, and can be used in the future when we add pydantic/others
Signed-off-by: Filinto Duran <[email protected]>
sicoyle
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall LGTM, few comments/questions
Signed-off-by: Filinto Duran <[email protected]>
d633481 to
e149057
Compare
| coverage-clean: | ||
| rm -f .coverage .coverage.* coverage.xml | ||
|
|
||
| coverage-all: coverage-clean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it be moved now? Or maybe open a separate PR for it?
| def test_can_add_functions_after_stop(): | ||
| """Test that orchestrators/activities can be added after stopping the worker.""" | ||
|
|
||
| def orchestrator1(ctx: task.OrchestrationContext, _): | ||
| return "done" | ||
|
|
||
| def orchestrator2(ctx: task.OrchestrationContext, _): | ||
| return "done2" | ||
|
|
||
| def activity(ctx: task.ActivityContext, input): | ||
| return input | ||
|
|
||
| with worker.TaskHubGrpcWorker(stop_timeout=2.0) as w: | ||
| w.add_orchestrator(orchestrator1) | ||
| w.start() | ||
|
|
||
| c = client.TaskHubGrpcClient() | ||
| id = c.schedule_new_orchestration(orchestrator1) | ||
| state = c.wait_for_orchestration_completion(id, timeout=30) | ||
| assert state is not None | ||
| assert state.runtime_status == client.OrchestrationStatus.COMPLETED | ||
|
|
||
| # Should be able to add after stop | ||
| w.add_orchestrator(orchestrator2) | ||
| w.add_activity(activity) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, what's the point of adding after stopping?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testing that you can stop add start if wanted
Co-authored-by: Albert Callarisa <[email protected]> Signed-off-by: Filinto Duran <[email protected]>
Also from asyncio big PR, adding deterministic methods that are shared between sync/async context. Also increase test coverage of some previously not tested paths
current coverage: