Skip to content

Commit

Permalink
fix(ping probe): fix crash when host not found
Browse files Browse the repository at this point in the history
  • Loading branch information
macrat committed Apr 30, 2021
1 parent 77892b4 commit 704ab76
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions probe/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func (p PingProbe) Check(ctx context.Context, r Reporter) {
Status: store.STATUS_UNKNOWN,
Message: err.Error(),
})
return
}

ping := pingerV4
Expand Down
1 change: 1 addition & 0 deletions probe/ping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func TestPingProbe(t *testing.T) {
{"ping:localhost", store.STATUS_HEALTHY, `rtt\(min/avg/max\)=[0-9.]*/[0-9.]*/[0-9.]* send/rcv=4/4`},
{"ping:127.0.0.1", store.STATUS_HEALTHY, `rtt\(min/avg/max\)=[0-9.]*/[0-9.]*/[0-9.]* send/rcv=4/4`},
{"ping:::1", store.STATUS_HEALTHY, `rtt\(min/avg/max\)=[0-9.]*/[0-9.]*/[0-9.]* send/rcv=4/4`},
{"ping:of-course-definitely-no-such-host", store.STATUS_UNKNOWN, `.*`},
})

AssertTimeout(t, "ping:localhost")
Expand Down

0 comments on commit 704ab76

Please sign in to comment.