-
Notifications
You must be signed in to change notification settings - Fork 805
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
Ensure scanner scavenger stops in tests #5510
Ensure scanner scavenger stops in tests #5510
Conversation
76f5ac3
to
6800ae1
Compare
6800ae1
to
4ba06fe
Compare
4ba06fe
to
efd5d49
Compare
defer s.scvgr.Stop() | ||
timer := time.NewTimer(scavengerTestTimeout) | ||
select { | ||
case <-s.scvgr.stopped: |
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.
main caveat here is probably that, if it's in a live/dead-lock of some kind, it'll sit idle for N minutes until the whole test suite times out... though I guess it fails either way.
maybe that's better? does a timeout give you running goroutines? and do we have a reasonably-short go test
-level timeout set, e.g. ideally 1 minute?
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:
- yep, timeouts print stacks. should help find the issue when it occurs 👍
- outside the
host/ndc
folder (which has 20m), we have no specified timeout, which means currently "the whole package can test for 10? 30? minutes". and a small forever-blocking local test agrees with that, it's much longer than a minute at least.
so:
- 👍 yep I like this
- mind adding a default 1m timeout to all
go test
s in the makefile?
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 not sure that we can broadly state that our test will timeout in 1m. I'd say we can try setting to 5m. I'll create a separate PR for this experiment.
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.
my manual test took 10m to finish, so that's apparently the default (and all the "the default is 30m" and "the default is 1m" that google finds are likely coming from discussion in golang/go#48157, and are not actually the defaults)
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.
broadly state a 1m timeout: yea. might not be good enough / a separate PR is fine IMO.
we can also selectively reduce the timeout (but I think not add?) with t.SetTimeout
which might be good for these. long timeouts that eventually fail at an "obviously this could be caught MUCH earlier" are just really painful :\
What changed?
Ensure that scvngr is stopped if the test scenario times out.
Why?
If the test scenario will somehow take more than 10 seconds the test will fail, but can leak goroutine. So I ensure that the suite does the cleanup.
How did you test it?
Potential risks
Release notes
Documentation Changes