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
|
var acc testutil.Accumulator
|
||||||
dnsConfig.Port = 60054
|
dnsConfig.Port = 60054
|
||||||
dnsConfig.Timeout = 1
|
dnsConfig.Timeout = 1
|
||||||
var err error
|
|
||||||
|
|
||||||
channel := make(chan error, 1)
|
channel := make(chan error, 1)
|
||||||
go func() {
|
go func() {
|
||||||
channel <- acc.GatherError(dnsConfig.Gather)
|
channel <- acc.GatherError(dnsConfig.Gather)
|
||||||
}()
|
}()
|
||||||
select {
|
select {
|
||||||
case res := <-channel:
|
case err := <-channel:
|
||||||
err = res
|
assert.NoError(t, err)
|
||||||
case <-time.After(time.Second * 2):
|
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) {
|
func TestSettingDefaultValues(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue