mirror of https://github.com/k3s-io/k3s
![]() The current tests for the health package utilize a fake HTTP client for testing health checks and only cover a limited set of test cases. This patch removes the need for mocks by using the httptest package from the standard library. After removing the fake HTTP client a bug was found in the health.Check function; it incorrectly assumes that a http.Response is always non-nil. Fix the issue by moving the defer that closes the http.Response.Body after error handling. Related tests in the registry package have be refactored to work with the changes made to the health.Check function. All methods that implement the health.HTTPGetInterface interface now return a http.Response with with a noop http.Response.Body. This patch does not introduce any changes in behavior. |
||
---|---|---|
.. | ||
doc.go | ||
health.go | ||
health_check.go | ||
health_check_test.go |