Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This seems to fix the two randomly failing tests in
aexn_transfer_controller_test.exs
-gets transfers sorted by desc txi
andgets transfers sorted by asc txi
.The reason the tests were failing seems to be the fact that in
AeMdw.AexnTransfers.build_streamer/3
theAexnContractToTransfer
stream is switching the receiver and sender (for unification with the other stream), which leads to nondeterministic position of theaccount_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 consecutiveAexnContractToTransfer
, 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:
, 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 theaccount_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 :).