k3s/pkg/health
Kelsey Hightower fce90dc761 Improve test coverage for the health package and remove mocks
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.
2014-07-21 15:30:29 -07:00
..
doc.go Addressed comments. 2014-07-15 15:16:36 -07:00
health.go Improve test coverage for the health package and remove mocks 2014-07-21 15:30:29 -07:00
health_check.go fix typo 2014-07-18 14:13:55 +09:00
health_check_test.go Improve test coverage for the health package and remove mocks 2014-07-21 15:30:29 -07:00