From 5b4905e11da2a52afa0c3c0173328d4d8cfddb4e Mon Sep 17 00:00:00 2001 From: Pierre Souchay Date: Tue, 17 Apr 2018 09:42:08 +0200 Subject: [PATCH] More test cases + travis flacky --- agent/dns_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/agent/dns_test.go b/agent/dns_test.go index 5257075746..a428e153d9 100644 --- a/agent/dns_test.go +++ b/agent/dns_test.go @@ -2993,7 +2993,7 @@ func TestBinarySearch(t *testing.T) { msgSrc.Answer = append(msgSrc.Answer, &dns.SRV{Hdr: dns.RR_Header{Name: "redis.service.consul.", Class: 1, Rrtype: dns.TypeSRV, Ttl: 0x3c}, Port: 0x4c57, Target: target}) msgSrc.Extra = append(msgSrc.Extra, &dns.CNAME{Hdr: dns.RR_Header{Name: target, Class: 1, Rrtype: dns.TypeCNAME, Ttl: 0x3c}, Target: fmt.Sprintf("fx.168.%d.%d.", i/256, i%256)}) } - for _, maxSize := range []int{256, 512, 8192} { + for idx, maxSize := range []int{12, 256, 512, 8192, 65535} { msg := new(dns.Msg) msgSrc.Compress = true msgSrc.SetQuestion("redis.service.consul.", dns.TypeSRV) @@ -3012,8 +3012,8 @@ func TestBinarySearch(t *testing.T) { if predicted < len(buf) { t.Fatalf("Bug in DNS library: %d != %d", predicted, len(buf)) } - if len(buf) > maxSize || len(buf) < 1 { - t.Fatalf("bad: %d > %d", predicted, maxSize) + if len(buf) > maxSize || (idx != 0 && len(buf) < 16) || (maxSize == 65535 && blen != 50) { + t.Fatalf("bad[%d]: %d > %d", idx, len(buf), maxSize) } } }