agent: more lenient dns response test
This commit is contained in:
parent
f4543ffc78
commit
15de24c844
|
@ -1145,10 +1145,9 @@ func TestDNS_ServiceLookup_Randomize(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure the response is randomized each time.
|
// Ensure the response is randomized each time.
|
||||||
loops := 5
|
|
||||||
uniques := map[string]struct{}{}
|
uniques := map[string]struct{}{}
|
||||||
addr, _ := srv.agent.config.ClientListener("", srv.agent.config.Ports.DNS)
|
addr, _ := srv.agent.config.ClientListener("", srv.agent.config.Ports.DNS)
|
||||||
for i := 0; i < loops; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
m := new(dns.Msg)
|
m := new(dns.Msg)
|
||||||
m.SetQuestion("web.service.consul.", dns.TypeANY)
|
m.SetQuestion("web.service.consul.", dns.TypeANY)
|
||||||
|
|
||||||
|
@ -1183,9 +1182,8 @@ func TestDNS_ServiceLookup_Randomize(t *testing.T) {
|
||||||
// Give some wiggle room. Since the responses are randomized and there
|
// Give some wiggle room. Since the responses are randomized and there
|
||||||
// is a finite number of combinations, requiring 0 duplicates every
|
// is a finite number of combinations, requiring 0 duplicates every
|
||||||
// test run eventually gives us failures.
|
// test run eventually gives us failures.
|
||||||
if len(uniques) < (loops - 1) {
|
if len(uniques) < 2 {
|
||||||
t.Fatalf("unique response ratio too low: %d/%d\n%v",
|
t.Fatalf("unique response ratio too low: %d/10\n%v", len(uniques), uniques)
|
||||||
len(uniques), loops, uniques)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue