cnct/test: add incoming contest resolver test

This commit is contained in:
Joost Jager
2019-04-16 11:33:30 +02:00
parent 16ff4e3ffa
commit 3d17c2bcfe
3 changed files with 345 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
package contractcourt
import (
"os"
"runtime/pprof"
"testing"
"time"
)
// timeout implements a test level timeout.
func timeout(t *testing.T) func() {
done := make(chan struct{})
go func() {
select {
case <-time.After(5 * time.Second):
pprof.Lookup("goroutine").WriteTo(os.Stdout, 1)
panic("test timeout")
case <-done:
}
}()
return func() {
close(done)
}
}