-
Notifications
You must be signed in to change notification settings - Fork 881
chore: add Now, Since, AfterFunc to clock; use clock for configmaps test #13476
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
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @spikecurtis and the rest of your teammates on |
ddbd5b9
to
9492dac
Compare
ec72835
to
1da8c45
Compare
// Before we update the clock again, we need to be sure the timeout has | ||
// completed running. To do that, we check the new lastHandshake has been set | ||
require.Eventually(t, func() bool { | ||
uut.L.Lock() | ||
defer uut.L.Unlock() | ||
return uut.peers[p1ID].lastHandshake == lh | ||
}, testutil.WaitShort, testutil.IntervalFast) |
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.
Why do we no longer need this check?
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'm glad you asked! One of the benefits of this library compared with benbjohnson/clock
is that we can use Advance().MustWait()
to wait for all the AfterFunc()
functions to run. So, we don't need to use require.Eventually()
and peer into the internal state in order to ensure the timeout has been processed.
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.
Nice!
9492dac
to
087459c
Compare
Signed-off-by: Spike Curtis <spike@coder.com>
1da8c45
to
d5ad7ac
Compare
Merge activity
|
Add
Now()
,Since()
,AfterFunc()
to clockUse
clock
for configmaps test