Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed-up test by slicing time.sleep #1345

Merged
merged 1 commit into from
Nov 2, 2023
Merged
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
7 changes: 5 additions & 2 deletions compute_endpoint/tests/unit/test_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ def test_execute_function_exceeding_result_size_limit(test_worker):
def sleeper(t):
import time

time.sleep(t)
now = start = time.monotonic()
while now - start < t:
time.sleep(0.0001)
now = time.monotonic()
return True


Expand All @@ -153,7 +156,7 @@ def test_app_timeout(test_worker):
messagepack.message_types.Task(task_id=task_id, task_buffer=task_body)
)

with mock.patch.dict(os.environ, {"GC_TASK_TIMEOUT": "0.1"}):
with mock.patch.dict(os.environ, {"GC_TASK_TIMEOUT": "0.01"}):
packed_result = execute_task(task_id, task_body)

result = messagepack.unpack(packed_result)
Expand Down
Loading