Prevent a checkInProgressQueriesAtShutdownServer panic (#778)

* Prevent a checkInProgressQueriesAtShutdownServer panic

* Fix typo in comment
This commit is contained in:
Tom Thorogood 2018-10-10 04:11:42 +10:30 committed by Miek Gieben
parent ac339476d7
commit 39265ac07f
1 changed files with 4 additions and 0 deletions

View File

@ -629,6 +629,10 @@ func checkInProgressQueriesAtShutdownServer(t *testing.T, srv *Server, addr stri
wg.Add(requests)
var errOnce sync.Once
// t.Fail will panic if it's called after the test function has
// finished. Burning the sync.Once with a defer will prevent the
// handler from calling t.Errorf after we've returned.
defer errOnce.Do(func() {})
HandleFunc("example.com.", func(w ResponseWriter, req *Msg) {
defer wg.Done()