tests: implement HasHealth for mock health

This commit is contained in:
Michael Schurter 2018-12-18 16:53:18 -08:00
parent ba1ddd2238
commit c84998e996

View file

@ -76,6 +76,12 @@ func (m *mockHealthSetter) ClearHealth() {
m.taskEvents = nil
}
func (m *mockHealthSetter) HasHealth() bool {
m.mu.Lock()
defer m.mu.Unlock()
return m.healthy != nil
}
// TestHealthHook_PrerunPostrun asserts a health hook does not error if it is
// run and postrunned.
func TestHealthHook_PrerunPostrun(t *testing.T) {