add a timeout for the benchmark test

This commit is contained in:
Lucas Clemente
2016-09-08 14:24:38 +02:00
parent 8d2ae833f0
commit 75e15e03f7

View File

@@ -9,6 +9,7 @@ import (
mrand "math/rand"
"net"
"reflect"
"runtime/debug"
"time"
"unsafe"
@@ -143,7 +144,12 @@ var _ = Describe("Benchmarks", func() {
runtime := b.Time("transfer time", func() {
_, err := io.Copy(s1stream, bytes.NewReader(data))
Expect(err).NotTo(HaveOccurred())
<-done
select {
case <-done:
case <-time.After(10 * time.Second):
debug.PrintStack()
Fail("timeout")
}
})
session1.Close(nil)