Skip to content

Commit 3f76411

Browse files
author
Andrei Neagu
committed
explicit wait for removal
1 parent b432be3 commit 3f76411

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

packages/service-library/tests/long_running_tasks/test_long_running_tasks_lrt_api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ async def test_remove_task(
310310
_get_task_manager(long_running_managers),
311311
saved_context,
312312
task_id,
313+
wait_for_removal=True,
313314
)
314315

315316
await _assert_task_is_no_longer_present(

packages/service-library/tests/long_running_tasks/test_long_running_tasks_task.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ async def test_remove_task(
419419
task_id, with_task_context=empty_context
420420
)
421421
await long_running_manager.tasks_manager.remove_task(
422-
task_id, with_task_context=empty_context
422+
task_id, with_task_context=empty_context, wait_for_removal=True
423423
)
424424
with pytest.raises(TaskNotFoundError):
425425
await long_running_manager.tasks_manager.get_task_status(
@@ -453,10 +453,10 @@ async def test_remove_task_with_task_context(
453453
# removing task fails if wrong task context given
454454
with pytest.raises(TaskNotFoundError):
455455
await long_running_manager.tasks_manager.remove_task(
456-
task_id, with_task_context={"wrong_task_context": 12}
456+
task_id, with_task_context={"wrong_task_context": 12}, wait_for_removal=True
457457
)
458458
await long_running_manager.tasks_manager.remove_task(
459-
task_id, with_task_context=empty_context
459+
task_id, with_task_context=empty_context, wait_for_removal=True
460460
)
461461

462462

@@ -465,11 +465,14 @@ async def test_remove_unknown_task(
465465
):
466466
with pytest.raises(TaskNotFoundError):
467467
await long_running_manager.tasks_manager.remove_task(
468-
"invalid_id", with_task_context=empty_context
468+
"invalid_id", with_task_context=empty_context, wait_for_removal=True
469469
)
470470

471471
await long_running_manager.tasks_manager.remove_task(
472-
"invalid_id", with_task_context=empty_context, reraise_errors=False
472+
"invalid_id",
473+
with_task_context=empty_context,
474+
wait_for_removal=True,
475+
reraise_errors=False,
473476
)
474477

475478

@@ -532,7 +535,7 @@ async def test_list_tasks(
532535
)
533536
for task_index, task_id in enumerate(task_ids):
534537
await long_running_manager.tasks_manager.remove_task(
535-
task_id, with_task_context=empty_context
538+
task_id, with_task_context=empty_context, wait_for_removal=True
536539
)
537540
assert len(
538541
await long_running_manager.tasks_manager.list_tasks(

0 commit comments

Comments
 (0)