Skip to content

Conversation

Simon-Laux
Copy link
Contributor

@Simon-Laux Simon-Laux commented Oct 11, 2025

and fix the mistakes in tests that get discovered by this.

  • add tests for setting the offset
  • fix the tests that were discovered by this
  • find a solution for the golden test problem (golden tests expect the offset to be deterministic, currently it is derived from the account id which is random)

closes #6799

@Simon-Laux
Copy link
Contributor Author

Seems my approach of just dividing the random number does not work, this approach is not compatible with the golden tests:

    thread 'tests::verified_chats::test_verified_chat_editor_reordering' panicked at src/test_utils.rs:977:13:
    assertion failed: `(left == right)`: To update the expected value, run `UPDATE_GOLDEN_TESTS=1 cargo test`

    Diff < left / right > :
    <Group#Chat#1979039380: Group [3 member(s)] 🛡️
    >Group#Chat#11: Group [3 member(s)] 🛡️

we could add an id to the named accounts, as this offset needs to be unique account per per test, but not unique across all tests.

@Simon-Laux Simon-Laux self-assigned this Oct 11, 2025
@Simon-Laux Simon-Laux changed the title test: Add unique offsets to ids generated by TestContext to increase test: Add unique offsets to ids generated by TestContext to increase test correctness Oct 11, 2025
@Hocuri
Copy link
Collaborator

Hocuri commented Oct 13, 2025

UPDATE_GOLDEN_TESTS=1 cargo nextest run

@Simon-Laux Simon-Laux force-pushed the simon/i6799-add-offset-to-testaccount-ids-to-make-tests-more-reliable branch from b85ffa1 to 6aa4739 Compare October 16, 2025 20:23
@Simon-Laux Simon-Laux marked this pull request as ready for review October 18, 2025 16:05
Copy link
Collaborator

@Hocuri Hocuri left a comment

Choose a reason for hiding this comment

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

Nice 🎉!

@Simon-Laux Simon-Laux requested review from Hocuri and link2xt October 19, 2025 15:51
correctness of tests.

The ids that get offsets are: contact ids chat ids message ids webxdc
status update ids
`receive_imf::receive_imf_tests::test_delayed_removal_is_ignored`
`receive_imf::receive_imf_tests::test_older_message_from_2nd_device`
`receive_imf::receive_imf_tests::test_two_group_securejoins`
`sql::migrations::migrations_tests::test_key_contacts_migration_email2`
`tests::verified_chats::test_verified_chat_editor_reordering`
@Simon-Laux Simon-Laux force-pushed the simon/i6799-add-offset-to-testaccount-ids-to-make-tests-more-reliable branch from fb7c93c to 1c77c06 Compare October 19, 2025 16:09
@Simon-Laux Simon-Laux merged commit 59fac54 into main Oct 19, 2025
30 checks passed
@Simon-Laux Simon-Laux deleted the simon/i6799-add-offset-to-testaccount-ids-to-make-tests-more-reliable branch October 19, 2025 17:08
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.

Offset row IDs in test accounts

3 participants