-
Notifications
You must be signed in to change notification settings - Fork 40
tests: speed up ordering tests by using simulation clock #302
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
base: main
Are you sure you want to change the base?
Conversation
simln-lib/src/lib.rs
Outdated
.unwrap() | ||
.iter() | ||
.cloned() | ||
.take(20) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like only 19 payments are generated. And the correct expected payment is
let expected_payment_list = vec![ pk1, pk2, pk1, pk1, pk1, pk3, pk3, pk3, pk4, pk3, pk2, pk1, pk4, pk2, pk2, pk2, pk2, pk1, pk3, ];
Speed up this test by using our sim clock that can speed up the simulation. The downside of this clock is that we may stop one payment over/under if we try to match exactly to the number of payments that we expect in a given period of time. Instead, we generate our set of expected payment and then run the simulation for much longer than we need to get this expected list, so we should always get at least this subset. We then just assert that the payments we get exactly match this first set.
I think that we have a race here - this passes on my machine and is failing here. Pushed a change to make this 12 payments, so that we definitely hit the target count - diff was trivial so didn't use a fixup. DId a quick flake test here with: And I run into an issue where the second last (index 10) payment is either |
I found the issue. I think one possible solution would be to round to the first decimal place. WDYT? |
Pulling this out of #301 to speed up the tests so we don't have to wait ~1min for each run, this change gets full test suite back down to ~5s.