Skip to content

Commit 690c02a

Browse files
author
Andrei Neagu
committed
fixed test
1 parent d13a617 commit 690c02a

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

services/dynamic-scheduler/tests/unit/services/generic_scheduler/test__deferred_runner.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ async def execute(
184184
_ = app
185185
_ = required_context
186186
_StepResultStore.set_result(cls.__name__, "executed")
187-
await asyncio.sleep(10000)
187+
await asyncio.sleep(1e6)
188188
return {}
189189

190190
@classmethod
@@ -194,7 +194,7 @@ async def revert(
194194
_ = app
195195
_ = required_context
196196
_StepResultStore.set_result(cls.__name__, "destroyed")
197-
await asyncio.sleep(10000)
197+
await asyncio.sleep(1e6)
198198
return {}
199199

200200

@@ -240,14 +240,14 @@ def _get_step_group(
240240
Operation(
241241
SingleStepGroup(_StepLongRunningToCancel),
242242
),
243-
StepStatus.CANCELLED,
243+
StepStatus.RUNNING,
244244
_Action.CANCEL,
245245
1,
246246
),
247247
],
248248
)
249249
@pytest.mark.parametrize("is_executing", [True, False])
250-
async def test_something(
250+
async def test_workflow(
251251
mock_enqueue_event: AsyncMock,
252252
registed_operation: None,
253253
app: FastAPI,
@@ -304,7 +304,7 @@ async def test_something(
304304
await asyncio.sleep(0.2) # give it some time to start
305305

306306
task_uid = await step_proxy.read("deferred_task_uid")
307-
await DeferredRunner.cancel(task_uid)
307+
await asyncio.create_task(DeferredRunner.cancel(task_uid))
308308

309309
await _assert_finshed_with_status(step_proxy, expected_step_status)
310310

@@ -317,4 +317,9 @@ async def test_something(
317317
assert "I failed" in error_traceback
318318

319319
# ensure called once with arguments
320-
assert mock_enqueue_event.call_args_list == [((app, schedule_id),)]
320+
321+
assert (
322+
mock_enqueue_event.call_args_list == []
323+
if action == _Action.CANCEL
324+
else [((app, schedule_id),)]
325+
)

0 commit comments

Comments
 (0)