Perform DNS lookup before ping (#3385)

This commit is contained in:
Vladimir S
2017-10-26 23:35:37 +03:00
committed by Daniel Nelson
parent 5885ef2c1c
commit 88ec171293
5 changed files with 61 additions and 22 deletions

View File

@@ -4,9 +4,10 @@ package ping
import (
"errors"
"testing"
"github.com/influxdata/telegraf/testutil"
"github.com/stretchr/testify/assert"
"testing"
)
// Windows ping format ( should support multilanguage ?)
@@ -81,6 +82,7 @@ func TestPingGather(t *testing.T) {
"average_response_ms": 50.0,
"minimum_response_ms": 50.0,
"maximum_response_ms": 52.0,
"result_code": 0,
}
acc.AssertContainsTaggedFields(t, "ping", fields, tags)
@@ -121,6 +123,7 @@ func TestBadPingGather(t *testing.T) {
"reply_received": 0,
"percent_packet_loss": 100.0,
"percent_reply_loss": 100.0,
"result_code": 0,
}
acc.AssertContainsTaggedFields(t, "ping", fields, tags)
}
@@ -167,6 +170,7 @@ func TestLossyPingGather(t *testing.T) {
"average_response_ms": 115.0,
"minimum_response_ms": 114.0,
"maximum_response_ms": 119.0,
"result_code": 0,
}
acc.AssertContainsTaggedFields(t, "ping", fields, tags)
}
@@ -269,6 +273,7 @@ func TestUnreachablePingGather(t *testing.T) {
"reply_received": 0,
"percent_packet_loss": 75.0,
"percent_reply_loss": 100.0,
"result_code": 0,
}
acc.AssertContainsTaggedFields(t, "ping", fields, tags)
@@ -315,6 +320,7 @@ func TestTTLExpiredPingGather(t *testing.T) {
"reply_received": 0,
"percent_packet_loss": 75.0,
"percent_reply_loss": 100.0,
"result_code": 0,
}
acc.AssertContainsTaggedFields(t, "ping", fields, tags)