-
Notifications
You must be signed in to change notification settings - Fork 437
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(auth): flaky credentials cache test #5979
Conversation
|
|
||
return ( | ||
this.loadedCredentialsModificationMillis !== credentialsLastModMillis || | ||
this.loadedConfigModificationMillis !== configLastModMillis |
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.
Can't remember if this was discussed already: maybe the delete/modification in the test happened too quickly, so the mtime didn't actually change on the re-created file?
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.
Thats what I suspect as well. When I added a sleep
in-between the two, the test appeared to pass.
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 simplification is good in any case.
Does this close an open issue? |
Problem
fs
race condition. We delete the credentials file, then create a new one. If the order of these operations is not preserved, the test can fail.waitUntil
within thefs
operations, such that each operation must succeed before returning, does not fix the problem.waitUntil
with the condition being that the contents of the file changed, also did not work since the file content is updating.fs.stat
is unreliable, as we can fully rewrite the file and itsmtime
andctime
fail to update (at least 10+ seconds, potentially never)fs.stat
on windows machine to determine if credentials need a refresh. We either need a new mechanism or don't cache on windows.Solution
fs.stat
altogether and refresh by reading the file each time.fs
call instead of two (twofs.stat
versus onefs.read
).License: I confirm that my contribution is made under the terms of the Apache 2.0 license.