-
Notifications
You must be signed in to change notification settings - Fork 820
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
Refactor of workerqueue health testing #164
Refactor of workerqueue health testing #164
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.
Looks good. The controller tests are hard to write and it's nice to move health checking concerns closer to where they belong.
defer server.Close() | ||
|
||
stop := make(chan struct{}) | ||
go func() { |
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 call to wq.Run
can be inlined to remove func
.
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.
Done!
wq := NewWorkerQueue(handler, logrus.WithField("source", "test"), "test") | ||
health.AddLivenessCheck("test", wq.Healthy) | ||
|
||
server := httptest.NewServer(health) |
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.
This is a great choice, as all the port handling between different tests isn't our responsibility.
@@ -109,7 +109,7 @@ func NewController( | |||
c.recorder = eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: "gameserver-controller"}) | |||
|
|||
c.workerqueue = workerqueue.NewWorkerQueue(c.syncGameServer, c.logger, stable.GroupName+".GameServerController") | |||
health.AddLivenessCheck("game-server-worker-queue", healthcheck.Check(c.workerqueue.Healthy)) | |||
health.AddLivenessCheck("gameserver-workerqueue", healthcheck.Check(c.workerqueue.Healthy)) |
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.
Do you know of a convention for naming these liveness checks from Kubernetes?
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.
No idea. I just figured keep it closer to the names of the CRDs and objects that back them.
Build Succeeded 👏 Build Id: 38e60c79-1792-458b-bdac-ef91de9f19de The following development artifacts have been built, and will exist for the next 30 days:
|
- Moved the health check testing out of the gameserver controller, into the workerqueue test as the health check will be in place in multiple controllers - Added the use of the httptest package, so we can run this test in parralel - Updated more tests to be parralel.
1b7d104
to
3567899
Compare
Build Succeeded 👏 Build Id: 22108b8a-2c74-400b-9042-7f33998cb93b The following development artifacts have been built, and will exist for the next 30 days:
|
httptest
package, so we can run this test in parralel