tests: Fix test by sorting results#5103
Merged
Merged
Conversation
winder
reviewed
Feb 2, 2023
Comment on lines
+143
to
+146
| // sort the result so we have deterministic order | ||
| sort.Slice(*converted.KvMods, func(i, j int) bool { | ||
| return bytes.Compare(*(*converted.KvMods)[i].Key, *(*converted.KvMods)[j].Key) < 0 | ||
| }) |
Contributor
There was a problem hiding this comment.
There is also a require.ElementsMatch feature which claims to ignore the order
Contributor
Author
There was a problem hiding this comment.
Yeah I wasn't sure if that would do a deep equals or not.
Codecov Report
@@ Coverage Diff @@
## master #5103 +/- ##
==========================================
- Coverage 53.41% 53.39% -0.02%
==========================================
Files 431 431
Lines 54369 54369
==========================================
- Hits 29040 29033 -7
- Misses 23066 23074 +8
+ Partials 2263 2262 -1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
winder
approved these changes
Feb 2, 2023
algorandskiy
approved these changes
Feb 2, 2023
This was referenced Mar 10, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
e544fc8 introduced additional test cases for the output of a
model.LedgerStateDeltaconversion fromledgercore.StateDelta, but it assumes that the output order of KvMods in the result will be equal to the input order.In other words
[{"box1"},{"box2"},{"box3"}]may convert to[{"box2"},{"box1"},{"box3"}]so we need to sort the output to get deterministic results.