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: randomly failing tests #1718

Merged
merged 2 commits into from Mar 29, 2024
Merged

fix: randomly failing tests #1718

merged 2 commits into from Mar 29, 2024

Conversation

vatanasov
Copy link
Contributor

This seems to fix the two randomly failing tests in aexn_transfer_controller_test.exs - gets transfers sorted by desc txi and gets transfers sorted by asc txi.

The reason the tests were failing seems to be the fact that in AeMdw.AexnTransfers.build_streamer/3 the AexnContractToTransfer stream is switching the receiver and sender (for unification with the other stream), which leads to nondeterministic position of the account_pk in the cursor when deserializing.

The tests managed to pass randomly because the data for the setup consists of 20 consecutive AexnContractFromTransfer, followed by 20 consecutive AexnContractToTransfer, so basically the first 2 pages (as required by the tests) were consisting of the same type, and unless the other PK is smaller (or larger, based on the failing test) than the key_boundary, they will not be intervene. When the setup data is changed to alternate, instead of groups of 20, the tests were failing constantly.

In some cases all tests were passing because the setup has:

{@from_pk1, @account_pk, @aex9_pk3}
{@account_pk, @to_pk1, @aex9_pk3}

, so basically if the @from_pk1 and @to_pk1 (the other PK that was misplaced in deserializing) were randomly assigned "good" values (one smaller, one larger than the account_pk) - both tests will pass, and if they were both "bad" values, both tests will fail, so technically in half the cases one of the tests was failing.

In any case, this is what we found during our investigation, and the fix seems to work :).

vatanasov and others added 2 commits March 29, 2024 14:04
Co-authored-by: Mihail Dobrev <mixaildobrev@gmail.com>
@sborrazas sborrazas merged commit 41e74c1 into master Mar 29, 2024
7 checks passed
@sborrazas sborrazas deleted the fix-randomly-failing-test branch March 29, 2024 17:11
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.

None yet

3 participants