diff --git a/tests/cores/mega/test_aio.py b/tests/cores/mega/test_aio.py index 4187cb0349..cc9bd5652a 100644 --- a/tests/cores/mega/test_aio.py +++ b/tests/cores/mega/test_aio.py @@ -81,7 +81,7 @@ def tearDown(self): self.process3.terminate() async def test_schedule(self): - t = time.time() + t = time.monotonic() task1 = asyncio.create_task(self.service_builder.schedule(initial_inputs={"text": "hello, "})) task2 = asyncio.create_task(self.service_builder.schedule(initial_inputs={"text": "hi, "})) await asyncio.gather(task1, task2) @@ -93,7 +93,7 @@ async def test_schedule(self): self.assertEqual(result_dict2[self.s2.name]["text"], "hi, opea project1!") self.assertEqual(result_dict2[self.s3.name]["text"], "hi, opea project2!") self.assertEqual(len(self.service_builder.get_all_final_outputs(result_dict1, runtime_graph1).keys()), 2) - self.assertEqual(int(time.time() - t), 15) + self.assertEqual(int(time.monotonic() - t), 15) if __name__ == "__main__": diff --git a/tests/cores/mega/test_service_orchestrator_streaming.py b/tests/cores/mega/test_service_orchestrator_streaming.py index 1327a59344..b3199ad712 100644 --- a/tests/cores/mega/test_service_orchestrator_streaming.py +++ b/tests/cores/mega/test_service_orchestrator_streaming.py @@ -112,7 +112,7 @@ def test_extract_chunk_str(self): self.assertEqual(res, "example test.") def test_token_generator(self): - start = time.time() + start = time.monotonic() sentence = "I write an example test." for i in self.service_builder.token_generator( sentence=sentence, token_start=start, is_first=True, is_last=False