Set high timeouts in server_test.go not to fail on slow boxes and catch deadlocks

This commit is contained in:
Filippo Valsorda 2015-10-05 14:41:02 +01:00
parent a58e9c7a9e
commit e6885e3677
1 changed files with 6 additions and 3 deletions

View File

@ -6,6 +6,7 @@ import (
"runtime"
"sync"
"testing"
"time"
)
func HelloServer(w ResponseWriter, req *Msg) {
@ -41,7 +42,7 @@ func RunLocalUDPServer(laddr string) (*Server, string, error) {
if err != nil {
return nil, "", err
}
server := &Server{PacketConn: pc}
server := &Server{PacketConn: pc, ReadTimeout: time.Hour, WriteTimeout: time.Hour}
waitLock := sync.Mutex{}
waitLock.Lock()
@ -61,7 +62,8 @@ func RunLocalUDPServerUnsafe(laddr string) (*Server, string, error) {
if err != nil {
return nil, "", err
}
server := &Server{PacketConn: pc, Unsafe: true}
server := &Server{PacketConn: pc, Unsafe: true,
ReadTimeout: time.Hour, WriteTimeout: time.Hour}
waitLock := sync.Mutex{}
waitLock.Lock()
@ -82,7 +84,7 @@ func RunLocalTCPServer(laddr string) (*Server, string, error) {
return nil, "", err
}
server := &Server{Listener: l}
server := &Server{Listener: l, ReadTimeout: time.Hour, WriteTimeout: time.Hour}
waitLock := sync.Mutex{}
waitLock.Lock()
@ -422,6 +424,7 @@ func ExampleDecorateWriter() {
server := &Server{
PacketConn: pc,
DecorateWriter: wf,
ReadTimeout: time.Hour, WriteTimeout: time.Hour,
}
waitLock := sync.Mutex{}