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

Fix created_at/updated_at flaky comparison tests #2060

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

hectorgomezv
Copy link
Member

Summary

This PR adds logic to manage the corner case where the update_at and created_at database fields have the same value after an insertion and update took place subsequently. Sometimes the operations are performed during the same millisecond so both timestamps are the same one, and the migration tests checking the updated_at is greater than created_at fail.

An example can be seen at https://github.com/safe-global/safe-client-gateway/actions/runs/11515722403/job/32056943212

Summary of all failing tests
FAIL migrations/deprecated/__tests__/00001_accounts.spec.ts
  ● Migration 00001_accounts › should add and update row timestamps

    expect(received).toBeGreaterThan(expected)

    Expected: > 1729849189006
    Received:   1729849189006

Changes

  • Adds 1 millisecond delays to updated_at checks during the migrations tests.

@hectorgomezv hectorgomezv self-assigned this Oct 25, 2024
@hectorgomezv hectorgomezv requested a review from a team as a code owner October 25, 2024 10:24
@hectorgomezv hectorgomezv merged commit c6e18be into main Oct 25, 2024
20 checks passed
@hectorgomezv hectorgomezv deleted the fix-timestamp-flaky-tests branch October 25, 2024 10:35
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