Fix incorrect results in ping plugin (#6581)
This commit is contained in:
parent
9efc37606f
commit
f0a578492a
|
@ -293,10 +293,12 @@ func (p *Ping) pingToURLNative(destination string, acc telegraf.Accumulator) {
|
||||||
if strings.Contains(err.Error(), "not permitted") {
|
if strings.Contains(err.Error(), "not permitted") {
|
||||||
sent.sent = false
|
sent.sent = false
|
||||||
}
|
}
|
||||||
|
sents <- sent
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
resps <- resp
|
resps <- resp
|
||||||
|
sents <- sent
|
||||||
}(i + 1)
|
}(i + 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -355,4 +355,5 @@ func TestPingGatherNative(t *testing.T) {
|
||||||
|
|
||||||
assert.NoError(t, acc.GatherError(p.Gather))
|
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_transmitted", 5))
|
||||||
|
assert.True(t, acc.HasPoint("ping", map[string]string{"url": "localhost"}, "packets_received", 5))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue