Fix incorrect results in ping plugin (#6581)

This commit is contained in:
Greg 2019-11-05 11:34:18 -07:00 committed by Daniel Nelson
parent 9efc37606f
commit f0a578492a
2 changed files with 3 additions and 0 deletions

View File

@ -293,10 +293,12 @@ func (p *Ping) pingToURLNative(destination string, acc telegraf.Accumulator) {
if strings.Contains(err.Error(), "not permitted") {
sent.sent = false
}
sents <- sent
return
}
resps <- resp
sents <- sent
}(i + 1)
}
}

View File

@ -355,4 +355,5 @@ func TestPingGatherNative(t *testing.T) {
assert.NoError(t, acc.GatherError(p.Gather))
assert.True(t, acc.HasPoint("ping", map[string]string{"url": "localhost"}, "packets_transmitted", 5))
assert.True(t, acc.HasPoint("ping", map[string]string{"url": "localhost"}, "packets_received", 5))
}