mirror of
https://github.com/valyala/fasthttp.git
synced 2026-06-14 15:56:44 +03:00
Make tests less flaky (#1189)
This commit is contained in:
+11
-1
@@ -483,6 +483,11 @@ func testParseByteRangeError(t *testing.T, v string, contentLength int) {
|
||||
}
|
||||
|
||||
func TestFSCompressConcurrent(t *testing.T) {
|
||||
// Don't run this test on Windows, the Windows Github actions are to slow and timeout too often.
|
||||
if runtime.GOOS == "windows" {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
// This test can't run parallel as files in / might be changed by other tests.
|
||||
|
||||
stop := make(chan struct{})
|
||||
@@ -513,7 +518,7 @@ func TestFSCompressConcurrent(t *testing.T) {
|
||||
for i := 0; i < concurrency; i++ {
|
||||
select {
|
||||
case <-ch:
|
||||
case <-time.After(time.Second * 3):
|
||||
case <-time.After(time.Second * 2):
|
||||
t.Fatalf("timeout")
|
||||
}
|
||||
}
|
||||
@@ -540,6 +545,11 @@ func TestFSCompressSingleThread(t *testing.T) {
|
||||
}
|
||||
|
||||
func testFSCompress(t *testing.T, h RequestHandler, filePath string) {
|
||||
// File locking is flaky on Windows.
|
||||
if runtime.GOOS == "windows" {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
var ctx RequestCtx
|
||||
ctx.Init(&Request{}, nil, nil)
|
||||
|
||||
|
||||
@@ -1991,7 +1991,7 @@ func (h *RequestHeader) tryRead(r *bufio.Reader, n int) error {
|
||||
// This is for go 1.6 bug. See https://github.com/golang/go/issues/14121 .
|
||||
if err == bufio.ErrBufferFull {
|
||||
return &ErrSmallBuffer{
|
||||
error: fmt.Errorf("error when reading request headers: %w", errSmallBuffer),
|
||||
error: fmt.Errorf("error when reading request headers: %w (n=%d, r.Buffered()=%d)", errSmallBuffer, n, r.Buffered()),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1142,7 +1142,7 @@ func TestServerTLSReadTimeout(t *testing.T) {
|
||||
|
||||
select {
|
||||
case err = <-r:
|
||||
case <-time.After(time.Second):
|
||||
case <-time.After(time.Second * 2):
|
||||
}
|
||||
|
||||
if err == nil {
|
||||
|
||||
Reference in New Issue
Block a user