Created
August 1, 2022 10:08
-
-
Save shar1z/0a5ee085833c9a942a1fd60984536ea5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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