Prevent a checkInProgressQueriesAtShutdownServer panic (#778)
* Prevent a checkInProgressQueriesAtShutdownServer panic * Fix typo in comment
This commit is contained in:
parent
ac339476d7
commit
39265ac07f
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue