Fix TestGatheringTimeout test for dns_query plugin (#4842)
This commit is contained in:
parent
8a03a21de2
commit
502d9ab499
|
@ -117,21 +117,17 @@ func TestGatheringTimeout(t *testing.T) {
|
|||
var acc testutil.Accumulator
|
||||
dnsConfig.Port = 60054
|
||||
dnsConfig.Timeout = 1
|
||||
var err error
|
||||
|
||||
channel := make(chan error, 1)
|
||||
go func() {
|
||||
channel <- acc.GatherError(dnsConfig.Gather)
|
||||
}()
|
||||
select {
|
||||
case res := <-channel:
|
||||
err = res
|
||||
case err := <-channel:
|
||||
assert.NoError(t, err)
|
||||
case <-time.After(time.Second * 2):
|
||||
err = nil
|
||||
assert.Fail(t, "DNS query did not timeout")
|
||||
}
|
||||
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "i/o timeout")
|
||||
}
|
||||
|
||||
func TestSettingDefaultValues(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue