Commit Graph

6 Commits (3800c3bdcb4241b46c0b1a0960cdaeb3bb2636bc)

Author SHA1 Message Date
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
Yuki Yugui Sonoda e0d749f952 fix typo 2014-07-18 14:13:55 +09:00
Yuki Yugui Sonoda 5e31ca3b27 Correct godoc messages according to review comments 2014-07-17 12:27:58 +09:00
Yuki Sonoda (Yugui) df9da65939 Rename a function according to go convention 2014-07-16 22:05:06 +09:00
Yuki Sonoda (Yugui) f368e4be68 Fixes golint errors in pkg/health 2014-07-16 21:59:21 +09:00
Brendan Burns c5db874090 Addressed comments. 2014-07-15 15:16:36 -07:00