Fix ntpq parse issue when using dns_lookup (#3026)
This commit is contained in:
@@ -247,6 +247,21 @@ func TestBadWhenNTPQ(t *testing.T) {
|
||||
acc.AssertContainsTaggedFields(t, "ntpq", fields, tags)
|
||||
}
|
||||
|
||||
// TestParserNTPQ - realated to:
|
||||
// https://github.com/influxdata/telegraf/issues/2386
|
||||
func TestParserNTPQ(t *testing.T) {
|
||||
tt := tester{
|
||||
ret: []byte(multiParserNTPQ),
|
||||
err: nil,
|
||||
}
|
||||
|
||||
n := &NTPQ{
|
||||
runQ: tt.runqTest,
|
||||
}
|
||||
acc := testutil.Accumulator{}
|
||||
assert.NoError(t, acc.GatherError(n.Gather))
|
||||
}
|
||||
|
||||
func TestMultiNTPQ(t *testing.T) {
|
||||
tt := tester{
|
||||
ret: []byte(multiNTPQ),
|
||||
@@ -463,3 +478,9 @@ var multiNTPQ = ` remote refid st t when poll reach delay
|
||||
5.9.29.107 10.177.80.37 2 u 703 1024 377 205.704 160.406 449602.
|
||||
91.189.94.4 10.177.80.37 2 u 673 1024 377 143.047 274.726 449445.
|
||||
`
|
||||
var multiParserNTPQ = ` remote refid st t when poll reach delay offset jitter
|
||||
==============================================================================
|
||||
+37.58.57.238 (d 192.53.103.103 2 u 10 1024 377 1.748 0.373 0.101
|
||||
+37.58.57.238 (domain) 192.53.103.103 2 u 10 1024 377 1.748 0.373 0.101
|
||||
+37.58.57.238 ( 192.53.103.103 2 u 10 1024 377 1.748 0.373 0.101
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user