Skip to content

Commit

Permalink
Propagate error component from WaitForHealthy. (#335)
Browse files Browse the repository at this point in the history
Reformat some files.
  • Loading branch information
DrMarcII authored Apr 3, 2019
1 parent 24771d4 commit afa8c44
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 5 additions & 1 deletion go/healthreporter/health_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,13 @@ func WaitForHealthy(ctx context.Context, h HealthReporter) error {
if errors.IsPermanent(err) {
return err
}
comp := errors.Component(err)
if comp == errors.DefaultComp {
comp = h.Name()
}
select {
case <-ctx.Done():
return errors.New(h.Name(), fmt.Errorf("%v waiting for healthy: %v", ctx.Err(), err))
return errors.New(comp, fmt.Errorf("%v waiting for healthy: %v", ctx.Err(), err))
case <-ticker.C:
}
}
Expand Down
3 changes: 1 addition & 2 deletions go/metadata/capabilities/capabilities_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ func TestStripAllPrefixedExcept(t *testing.T) {
exempt: []string{""},
out: &Capabilities{
AlwaysMatch: map[string]interface{}{},
FirstMatch: []map[string]interface{}{map[string]interface{}{}},
FirstMatch: []map[string]interface{}{{}},
},
},
{
Expand Down Expand Up @@ -1519,4 +1519,3 @@ func TestMergeUnder(t *testing.T) {
})
}
}

1 change: 0 additions & 1 deletion go/wsl/driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,4 +529,3 @@ func (f *fakeResponseWriter) Write(b []byte) (int, error) {
func (f *fakeResponseWriter) WriteHeader(statusCode int) {
log.Printf("%s status code: %d", f.prefix, statusCode)
}

0 comments on commit afa8c44

Please sign in to comment.