Skip to content

Commit

Permalink
record-tester: Fix stream health always firing with other errs
Browse files Browse the repository at this point in the history
We were passing an always not nil error to sendPagerDutyEvent.

We could make the error a pointer, but that wouldn't fix anything
since when we convert StreamHealthError to error it would still
result in a non-nil error: https://go.dev/play/p/1JDB0I910-4

So just drop the variable with an intermediate type, and set it
based on the result of errors.As instead of by errors.As.
  • Loading branch information
victorges committed Jul 19, 2022
1 parent 39dc65e commit b7bcb1a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/app/recordtester/continuous_record_tester.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ func (crt *continuousRecordTester) Start(fileName string, testDuration, pauseDur
msg := fmt.Sprintf(":rotating_light: Test of %s ended with err=%v errCode=%v", crt.host, err, es)
messenger.SendFatalMessage(msg)
glog.Warning(msg)
var sherr testers.StreamHealthError
if errors.As(err, &sherr) {
err = nil
var sherr error
if errors.As(err, &testers.StreamHealthError{}) {
sherr, err = err, nil
}
crt.sendPagerdutyEvent(rt, err, false)
crt.sendPagerdutyEvent(rt, sherr, true)
Expand Down

0 comments on commit b7bcb1a

Please sign in to comment.