Skip to content

test: wait for each response in the created times test - #342

Merged
utkarash2991 merged 1 commit into
masterfrom
utkarashsingh/fix-flaky-created-times-test
Nov 27, 2026
Merged

utkarash2991 merged 1 commit into
masterfrom
utkarashsingh/fix-flaky-created-times-test

Conversation

@utkarash2991

@utkarash2991 utkarash2991 commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

test_http_get_responses_have_different_created_times fails now and then on CI with assert 2 == 3. Latest one is on PG 14 in #303.

The test queues three requests with a one second sleep between them and expects three distinct created values in net._http_response. created defaults to now(), which is the start time of the worker transaction that inserts the row. The worker handles a whole batch in one transaction, so when two queued requests get picked up together they share a timestamp. The sleeps only space out the queueing. They do nothing for the responses, which is where created is set.

Now the test waits for each response before queueing the next request. Each response is then inserted by its own worker transaction, so the three timestamps differ by construction.

The test queued three requests with a one second sleep between them and expected three
distinct created values. created defaults to now(), the start time of the worker
transaction that inserts the row, and the worker handles a whole batch in one
transaction, so two requests picked up together shared a timestamp.

Now the test waits for each response before queueing the next request, so each one is
inserted by its own worker transaction.

@steve-chavez steve-chavez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I see the test is now not timing dependent.

@utkarash2991
utkarash2991 merged commit 3c1a963 into master Nov 27, 2026
20 checks passed
@utkarash2991
utkarash2991 deleted the utkarashsingh/fix-flaky-created-times-test branch November 27, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants