-
Notifications
You must be signed in to change notification settings - Fork 493
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
test: Fix restClientFixture test flaking #4484
test: Fix restClientFixture test flaking #4484
Conversation
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.
Good job Nicholas!
@@ -328,7 +329,7 @@ func (f *RestClientFixture) SendMoneyAndWait(curRound, amountToSend, transaction | |||
// SendMoneyAndWaitFromWallet is as above, but for a specific wallet | |||
func (f *RestClientFixture) SendMoneyAndWaitFromWallet(walletHandle, walletPassword []byte, curRound, amountToSend, transactionFee uint64, fromAccount, toAccount string, closeToAccount string) (txn v1.Transaction) { | |||
client := f.LibGoalClient | |||
fundingTx, err := client.SendPaymentFromWallet(walletHandle, walletPassword, fromAccount, toAccount, transactionFee, amountToSend, nil, closeToAccount, 0, 0) | |||
fundingTx, err := client.SendPaymentFromWallet(walletHandle, walletPassword, fromAccount, toAccount, transactionFee, amountToSend, nil, closeToAccount, basics.Round(curRound).SubSaturate(1), basics.Round(curRound+1000)) |
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.
fundingTx, err := client.SendPaymentFromWallet(walletHandle, walletPassword, fromAccount, toAccount, transactionFee, amountToSend, nil, closeToAccount, basics.Round(curRound).SubSaturate(1), basics.Round(curRound+1000)) | |
fundingTx, err := client.SendPaymentFromWallet(walletHandle, walletPassword, fromAccount, toAccount, transactionFee, amountToSend, nil, closeToAccount, basics.Round(curRound).SubSaturate(1), 0) |
I guess it is better to let the API to determine last valid that is proto (MaxTxnLife) dependant
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.
Sounds good. Another question: do you think its reasonable to just use basics.Round(curRound).SubSaturate(1)
?
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.
basics.Round(curRound).SubSaturate(1)
looks good to me as first valid
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.
looks like the problem we get curRound too early, and then it takes 3+ rounds more to fill rest of fields and submit the txn. Well, please set last valid to firstValid + maxTxnLife
like computeValidityRounds
does.
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.
The problem was that for that specific test, it inputted current round as current round + 5.
Codecov Report
@@ Coverage Diff @@
## master #4484 +/- ##
==========================================
+ Coverage 55.23% 55.25% +0.01%
==========================================
Files 398 398
Lines 50297 50297
==========================================
+ Hits 27784 27791 +7
+ Misses 20180 20177 -3
+ Partials 2333 2329 -4
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Summary
Many tests that use the restClientFixture flake for the following reason: The test spins up 2 nodes, Node A and Node B. Node A observes it is currently round r, but node B is still on round r-1. Node A then sends a tx with validity range (r, r+1000). Node B then discards the tx since r-1 is outside of the tx’s validity range. Then the test fails because the tx's are never processed if the proposer of each round happens to be Node B.
This test fixes the issue by changing the validity window.
Test Plan
This is a test.