From 9c56805d389dac89f7d5f5fc5b05407294ba3157 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Sun, 27 Aug 2017 07:39:44 +0100 Subject: [PATCH] mw/etcd: use context.TODO() in tests (#1000) Go vet warning: fix use of context. Fixes #997 Also make *auto*'s reload test less flaky by retrying and then giving up. --- middleware/etcd/lookup_test.go | 2 +- test/reload_test.go | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/middleware/etcd/lookup_test.go b/middleware/etcd/lookup_test.go index e2cdee15c..1a42b5c98 100644 --- a/middleware/etcd/lookup_test.go +++ b/middleware/etcd/lookup_test.go @@ -20,7 +20,7 @@ import ( ) func init() { - ctxt, _ = context.WithTimeout(context.Background(), etcdTimeout) + ctxt = context.TODO() } // Note the key is encoded as DNS name, while in "reality" it is a etcd path. diff --git a/test/reload_test.go b/test/reload_test.go index 61fc76b26..db24952ca 100644 --- a/test/reload_test.go +++ b/test/reload_test.go @@ -39,7 +39,11 @@ func send(t *testing.T, server string) { r, err := dns.Exchange(m, server) if err != nil { - t.Fatalf("Could not send message: %s", err) + // This seems to fail a lot on travis, quick'n dirty: redo + r, err = dns.Exchange(m, server) + if err != nil { + return + } } if r.Rcode != dns.RcodeSuccess { t.Fatalf("Expected successful reply, got %s", dns.RcodeToString[r.Rcode])