-
Notifications
You must be signed in to change notification settings - Fork 92
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
Fully shutdown healthchecker on t.Cleanup() #6968
base: master
Are you sure you want to change the base?
Conversation
bad1a9f
to
fbe63de
Compare
@@ -137,6 +137,7 @@ func GetTestEnv(t testing.TB) *real_environment.RealEnv { | |||
} | |||
|
|||
healthChecker := healthcheck.NewHealthChecker("test") | |||
t.Cleanup(healthChecker.Shutdown) |
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 think as written, the shutdown functions will run asynchronously, while new tests are allowed to start executing, which doesn't seem ideal 🤔
I'd say we might want to call WaitForGracefulShutdown
here but it looks like that has the side effect of starting the health checker loop, which might not be desired in tests? and it might increase test duration a bunch depending on how long the graceful shutdown takes
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.
Does it make sense to have a testonly healthchecker that does something different here?
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.
hmm actually it looks like NewHealthChecker() is already starting the health checker loop. So the only concern would be increasing test duration. Maybe worth a try though and seeing whether tests get significantly slower or not. I would guess that graceful shutdown should be quick as long as we don't have any tests that are accidentally keeping RPC streams open at the end, preventing shutdown.
Speaking of testonly healthchecker though, one thing that we shouldn't do in tests is register the SIGINT
/ SIGTERM
handlers - those are preventing Ctrl+C from working when running the test locally. But that's probably a separate issue.
fbe63de
to
92c6c10
Compare
92c6c10
to
d101ce2
Compare
7a4d125
to
37ce67a
Compare
37ce67a
to
491f5b2
Compare
Related issues: N/A