-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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(cosmovisor): fix typo daemon + fix flaky test #21487
Conversation
WalkthroughWalkthroughThe changes involve updating the Changes
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
b3e1da4
to
0adc633
Compare
appears failing test existed in previous PR |
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.
Thanks!
FYI previous PR does not close: Test still randomly failing needs a wait for file to be filled |
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.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Commits
Files that changed from the base of the PR and between ce8f9d4 and 0adc6333ba2c0bee4b74a6d28e407190e8ea3c34.
Files selected for processing (2)
- CHANGELOG.md (1 hunks)
- tools/cosmovisor/scanner.go (3 hunks)
Files skipped from review due to trivial changes (2)
- CHANGELOG.md
- tools/cosmovisor/scanner.go
Yes, I tried that but it will break other tests as the delay will still be too large, that's why it was commented. |
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.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Commits
Files that changed from the base of the PR and between 0adc6333ba2c0bee4b74a6d28e407190e8ea3c34 and f05b361a0604ee0bbd9de2f4b284f565753e04f1.
Files selected for processing (2)
- CHANGELOG.md (1 hunks)
- tools/cosmovisor/scanner.go (4 hunks)
Files skipped from review due to trivial changes (1)
- tools/cosmovisor/scanner.go
Files skipped from review as they are similar to previous changes (1)
- CHANGELOG.md
All tests pass. Do you know which test the 2ms wait breaks? |
Removing wait if file is filled. Will that avoid breaking other tests? |
Yeah that's a good one 👏 |
Ah, I see it still fails with the same error it did without the file size check :( |
Need a faster poll? We only give the chain 1 second to stop. |
68c0bbc
to
59b56cd
Compare
ShutdownGrace test can have 1 more second sleep before failing. The use case is the chain has a governance upgrade halt and needs to flush pebbledb to disk before kill. Not urgent to kill the daemon. |
Only sonarcloud failing now |
Head branch was pushed to by a user without write access
e651ac7
to
6db87b9
Compare
added retry loop |
@raynaudoe Off topic: Are you maintaining cosmos/keyring? cosmos/keyring#3 |
Yep happy to review the PR! will do later today, thanks |
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.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Commits
Files that changed from the base of the PR and between f05b361a0604ee0bbd9de2f4b284f565753e04f1 and c7df382.
Files selected for processing (3)
- tools/cosmovisor/process_test.go (2 hunks)
- tools/cosmovisor/scanner.go (5 hunks)
- tools/cosmovisor/testdata/dontdie/cosmovisor/genesis/bin/dummyd (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- tools/cosmovisor/scanner.go
Additional context used
Path-based instructions (1)
tools/cosmovisor/process_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"
Additional comments not posted (4)
tools/cosmovisor/testdata/dontdie/cosmovisor/genesis/bin/dummyd (2)
14-15
: LGTM!The added comments provide clarity about the purpose and timing expectations of the sleep commands.
18-19
: LGTM!The added comment provides clarity about the state of the chain during the sleep. The increased sleep duration from 1 second to 2 seconds ensures adequate time for the shutdown process.
tools/cosmovisor/process_test.go (2)
148-148
: Verify the impact of the polling interval change on the test behavior.The
PollInterval
field in thecosmovisor.Config
structure has been decreased from 20 to 15 in theTestPlanShutdownGrace
function. Please ensure that this change does not introduce any unintended consequences or negatively impact the test behavior, particularly in scenarios where timing is critical.
28-28
: Verify the impact of the polling interval change on the test behavior.The
PollInterval
field in thecosmovisor.Config
structure has been decreased from 20 to 15 in theTestLaunchProcess
function. Please ensure that this change does not introduce any unintended consequences or negatively impact the test behavior, particularly in scenarios where timing is critical.
// check https://github.com/cosmos/cosmos-sdk/issues/21086 | ||
// If new file is still empty, wait a small amount of time for write to complete | ||
if stat.Size() == 0 { | ||
for range 10 { |
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.
nit: do you think this could be improved with exponential backoff? I think that this is too arbitrary and might cause again flakyness in the test.
for i range 10 {
...
time.Sleep(math.Pow(2, float64(i)) * time.Millisecond)
If it were to fail all 10 times, we would have waited a total of ~2046ms. Let's maybe reduce the amount of retries to 5 (62ms).
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.
We can modify in a follow up PR. In practice the loop never runs more than a few times since the file is quickly finalized. The failing test was related more to 1) not waiting at all (fixed here) and 2) test case delay being too similar to timeout (already fixed).
In production, retry or waiting some amount of time is necessary to avoid reading empty files (race condition).
Update spelling of deamon to daemon
Attempt to fix #21086
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
in the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.
I have...
Summary by CodeRabbit
Summary by CodeRabbit