Skip to content

Commit ad68977

Browse files
committed
fix unit tests
Signed-off-by: Michael Oviedo <mikeovi@amazon.com>
1 parent 95440e9 commit ad68977

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

tests/worker_coordinator/worker_coordinator_test.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2313,7 +2313,7 @@ def test_check_cpu_usage_drops_error_when_queue_full(self):
23132313
assert full_queue.qsize() == 1 # Still full; error dropped
23142314

23152315

2316-
class UnhingedExecutorTests(TestCase):
2316+
class AsyncNoAwaitExecutorTests(TestCase):
23172317
def setUp(self):
23182318
params.register_param_source_for_name("worker-coordinator-test-param-source", WorkerCoordinatorTestParamSource)
23192319

@@ -2340,7 +2340,7 @@ def setUp(self):
23402340
self.opensearch = {"default": opensearch_mock}
23412341

23422342
def test_unhinged_executor_initialization(self):
2343-
executor = worker_coordinator.UnhingedExecutor(
2343+
executor = worker_coordinator.AsyncNoAwaitExecutor(
23442344
client_id=0,
23452345
task=self.task,
23462346
schedule=self.schedule_handle,
@@ -2359,7 +2359,7 @@ def test_unhinged_executor_initialization(self):
23592359
self.assertTrue(executor.is_0)
23602360

23612361
def test_unhinged_executor_client_id_not_zero(self):
2362-
executor = worker_coordinator.UnhingedExecutor(
2362+
executor = worker_coordinator.AsyncNoAwaitExecutor(
23632363
client_id=1,
23642364
task=self.task,
23652365
schedule=self.schedule_handle,
@@ -2377,10 +2377,10 @@ def test_unhinged_executor_client_id_not_zero(self):
23772377
@mock.patch('osbenchmark.worker_coordinator.worker_coordinator.RequestContextHolder')
23782378
@mock.patch('asyncio.create_task')
23792379
@run_async
2380-
async def test_fire_and_forget_request_creates_task(self, mock_create_task, mock_context_holder):
2380+
async def test_async_no_await_request_creates_task(self, mock_create_task, mock_context_holder):
23812381
mock_context_holder.init_request_context.return_value = ({}, mock.Mock())
23822382

2383-
executor = worker_coordinator.UnhingedExecutor(
2383+
executor = worker_coordinator.AsyncNoAwaitExecutor(
23842384
client_id=0,
23852385
task=self.task,
23862386
schedule=self.schedule_handle,
@@ -2394,7 +2394,7 @@ async def test_fire_and_forget_request_creates_task(self, mock_create_task, mock
23942394

23952395
executor.runner = mock.AsyncMock()
23962396

2397-
await executor._fire_and_forget_request({}, 1.0, 0.0) # pylint: disable=protected-access
2397+
await executor._async_no_await_request({}, 1.0, 0.0) # pylint: disable=protected-access
23982398

23992399
mock_create_task.assert_called_once()
24002400

@@ -2403,12 +2403,12 @@ async def test_fire_and_forget_request_creates_task(self, mock_create_task, mock
24032403
@mock.patch('osbenchmark.worker_coordinator.worker_coordinator.RequestContextHolder')
24042404
@mock.patch('asyncio.create_task')
24052405
@run_async
2406-
async def test_fire_and_forget_request_with_throttling(self, mock_create_task, mock_context_holder,
2406+
async def test_async_no_await_request_with_throttling(self, mock_create_task, mock_context_holder,
24072407
mock_sleep, mock_perf_counter):
24082408
mock_context_holder.init_request_context.return_value = ({}, mock.Mock())
24092409
mock_perf_counter.return_value = 0.5 # Current time less than expected schedule time
24102410

2411-
executor = worker_coordinator.UnhingedExecutor(
2411+
executor = worker_coordinator.AsyncNoAwaitExecutor(
24122412
client_id=0,
24132413
task=self.task,
24142414
schedule=self.schedule_handle,
@@ -2422,7 +2422,7 @@ async def test_fire_and_forget_request_with_throttling(self, mock_create_task, m
24222422

24232423
executor.runner = mock.AsyncMock()
24242424

2425-
await executor._fire_and_forget_request({}, 1.0, 0.0) # pylint: disable=protected-access # expected_scheduled_time = 1.0
2425+
await executor._async_no_await_request({}, 1.0, 0.0) # pylint: disable=protected-access # expected_scheduled_time = 1.0
24262426

24272427
mock_sleep.assert_called_once_with(0.5) # Should sleep for the difference
24282428
mock_create_task.assert_called_once()
@@ -2432,12 +2432,12 @@ async def test_fire_and_forget_request_with_throttling(self, mock_create_task, m
24322432
@mock.patch('osbenchmark.worker_coordinator.worker_coordinator.RequestContextHolder')
24332433
@mock.patch('asyncio.create_task')
24342434
@run_async
2435-
async def test_fire_and_forget_request_no_throttling_needed(self, mock_create_task, mock_context_holder,
2435+
async def test_async_no_await_request_no_throttling_needed(self, mock_create_task, mock_context_holder,
24362436
mock_sleep, mock_perf_counter):
24372437
mock_context_holder.init_request_context.return_value = ({}, mock.Mock())
24382438
mock_perf_counter.return_value = 1.5 # Current time exceeds expected schedule time
24392439

2440-
executor = worker_coordinator.UnhingedExecutor(
2440+
executor = worker_coordinator.AsyncNoAwaitExecutor(
24412441
client_id=0,
24422442
task=self.task,
24432443
schedule=self.schedule_handle,
@@ -2451,7 +2451,7 @@ async def test_fire_and_forget_request_no_throttling_needed(self, mock_create_ta
24512451

24522452
executor.runner = mock.AsyncMock()
24532453

2454-
await executor._fire_and_forget_request({}, 1.0, 0.0) # pylint: disable=protected-access # expected_scheduled_time = 1.0
2454+
await executor._async_no_await_request({}, 1.0, 0.0) # pylint: disable=protected-access # expected_scheduled_time = 1.0
24552455

24562456
mock_sleep.assert_not_called() # No sleep needed
24572457
mock_create_task.assert_called_once()

0 commit comments

Comments
 (0)