-
Notifications
You must be signed in to change notification settings - Fork 20k
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
accounts: fix TestUpdateKeyfileContents #29867
accounts: fix TestUpdateKeyfileContents #29867
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.
I like the idea!
After further investigation, I discovered a function called
The initial two commits attempt to rectify the situation after the aforementioned issues arise. However, a simpler solution to fix this test is to create the directory before NewKeyStore. This ensures the watcher successfully starts on the first attempt, and Considering TestUpdatedKeyfileContents aims to verify if the cache updates correctly when the keystore file changes, the straightforward fix is more appropriate. Nonetheless, the initial two commits remain valuable if, in practical usage, the directory is created after NewKeyStore. @fjl I would like to hear your suggestions. |
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.
If this fix fixes the issue, then LGTM. For this specific test, I don't think creating the keystore beforehand makes any difference for the test
This will prevent the file watcher failure due to "non-existent folder" and fix the test accordingly. |
Right, yes I meant that it will not negatively impact the "things being tested" |
Create the directory before NewKeyStore. This ensures the watcher successfully starts on the first attempt, and waitWatcherStart functions as intended.
Create the directory before NewKeyStore. This ensures the watcher successfully starts on the first attempt, and waitWatcherStart functions as intended.
This pull request fixes a flaky test TestUpdatedKeyfileContents in #29830
Problem Statement:
In this test, we start a watcher to monitor file changes and then update memory cache. If the first file change event is sent before the watcher is ready, the watcher may miss this event , resulting in a perpetual blockage and failure to update the cache. This is the root cause behind occasional errors such as "First replacement failed" encountered in TestUpdatedKeyfileContents.
Repro Steps:
Solution:
Use WaitGroup to ensure that the watcher loop starts before sending file change events.