forked from quic-go/quic-go
add a timeout for the benchmark test
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
|||||||
mrand "math/rand"
|
mrand "math/rand"
|
||||||
"net"
|
"net"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"runtime/debug"
|
||||||
"time"
|
"time"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
@@ -143,7 +144,12 @@ var _ = Describe("Benchmarks", func() {
|
|||||||
runtime := b.Time("transfer time", func() {
|
runtime := b.Time("transfer time", func() {
|
||||||
_, err := io.Copy(s1stream, bytes.NewReader(data))
|
_, err := io.Copy(s1stream, bytes.NewReader(data))
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
<-done
|
select {
|
||||||
|
case <-done:
|
||||||
|
case <-time.After(10 * time.Second):
|
||||||
|
debug.PrintStack()
|
||||||
|
Fail("timeout")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
session1.Close(nil)
|
session1.Close(nil)
|
||||||
|
|||||||
Reference in New Issue
Block a user