Skip to content

Instantly share code, notes, and snippets.

@shar1z
Created August 1, 2022 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shar1z/0a5ee085833c9a942a1fd60984536ea5 to your computer and use it in GitHub Desktop.
Save shar1z/0a5ee085833c9a942a1fd60984536ea5 to your computer and use it in GitHub Desktop.
def test_task_completed_arrived_before_task_started():
# First of all, send a task_completed event
_send_task_completed_event()
# Now wait a bit, and send a task_started event
time.sleep(3)
_send_task_started_event()
completed = False
with time_limit(MAX_RETRY_COUNT * 10): # Limit the time the test can run
while not completed:
time.sleep(5)
task = _get_task_from_db()
if task.is_completed:
completed = True
assert task.started_at < task.completed_at # Verify the processing order of events
assert completed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment