Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion tests/helpers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
UpdateMethodMultiParam,
)

DEFAULT_WORKER_KWARGS: dict[str, Any] = {}


def new_worker(
client: Client,
Expand All @@ -47,7 +49,7 @@ def new_worker(
workflow_runner=workflow_runner,
max_cached_workflows=max_cached_workflows,
workflow_failure_exception_types=workflow_failure_exception_types,
**kwargs,
**(DEFAULT_WORKER_KWARGS | kwargs),
)


Expand Down
41 changes: 41 additions & 0 deletions tests/worker/test_workflow_worker_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"""
Run tests in test_workflow.py with different worker configurations.
"""

import inspect

import pytest

import tests.helpers
import tests.worker.test_workflow as test_workflow_module

_worker_configs = [
pytest.param(
{
"max_concurrent_workflow_tasks": 2,
"max_concurrent_workflow_task_polls": 2,
},
id="max_concurrent_workflow_tasks_2_polls_2",
),
pytest.param(
{
"max_concurrent_workflow_task_polls": 10,
"nonsticky_to_sticky_poll_ratio": 0.5,
},
id="max_concurrent_workflow_task_polls_10_nonsticky_to_sticky_poll_ratio_0.5",
),
]


@pytest.fixture(scope="module", autouse=True, params=_worker_configs)
def worker_config(request):
original_kwargs = tests.helpers.DEFAULT_WORKER_KWARGS.copy()
tests.helpers.DEFAULT_WORKER_KWARGS.update(request.param)
yield
tests.helpers.DEFAULT_WORKER_KWARGS.clear()
tests.helpers.DEFAULT_WORKER_KWARGS.update(original_kwargs)


for name, fn in inspect.getmembers(test_workflow_module, inspect.isfunction):
if name.startswith("test_"):
globals()[name] = fn
Loading