aboutsummaryrefslogtreecommitdiff
path: root/fs_test.go
diff options
context:
space:
mode:
authorGravatar Erik Dubbelboer <erik@dubbelboer.com> 2021-09-05 10:45:21 +0200
committerGravatar Erik Dubbelboer <erik@dubbelboer.com> 2021-09-05 10:45:21 +0200
commit3f70d780be53be428ca38c4c75bfb0574e5d47d6 (patch)
treebf38f68a15bf0c4af47f7512c14861ae0806315b /fs_test.go
parentcompatible with new build tag (#1087) (diff)
downloadfasthttp-3f70d780be53be428ca38c4c75bfb0574e5d47d6.tar.gz
fasthttp-3f70d780be53be428ca38c4c75bfb0574e5d47d6.tar.bz2
fasthttp-3f70d780be53be428ca38c4c75bfb0574e5d47d6.zip
Some FS tests can't run in parallel
These tests all try to create the compressed versions of files at the same time which might lead to concurrency errors.
Diffstat (limited to 'fs_test.go')
-rw-r--r--fs_test.go30
1 files changed, 8 insertions, 22 deletions
diff --git a/fs_test.go b/fs_test.go
index 4122e4c..068c67c 100644
--- a/fs_test.go
+++ b/fs_test.go
@@ -112,7 +112,7 @@ func TestPathNotFoundFunc(t *testing.T) {
}
func TestServeFileHead(t *testing.T) {
- t.Parallel()
+ // This test can't run parallel as files in / might by changed by other tests.
var ctx RequestCtx
var req Request
@@ -204,7 +204,7 @@ func (pw pureWriter) Write(p []byte) (nn int, err error) {
}
func TestServeFileCompressed(t *testing.T) {
- t.Parallel()
+ // This test can't run parallel as files in / might by changed by other tests.
var ctx RequestCtx
ctx.Init(&Request{}, nil, nil)
@@ -270,7 +270,7 @@ func TestServeFileCompressed(t *testing.T) {
}
func TestServeFileUncompressed(t *testing.T) {
- t.Parallel()
+ // This test can't run parallel as files in / might by changed by other tests.
var ctx RequestCtx
var req Request
@@ -611,25 +611,9 @@ func testFSCompress(t *testing.T, h RequestHandler, filePath string) {
}
}
-func TestFileLock(t *testing.T) {
- t.Parallel()
-
- for i := 0; i < 10; i++ {
- filePath := fmt.Sprintf("foo/bar/%d.jpg", i)
- lock := getFileLock(filePath)
- lock.Lock()
- lock.Unlock() // nolint:staticcheck
- }
-
- for i := 0; i < 10; i++ {
- filePath := fmt.Sprintf("foo/bar/%d.jpg", i)
- lock := getFileLock(filePath)
- lock.Lock()
- lock.Unlock() // nolint:staticcheck
- }
-}
-
func TestFSHandlerSingleThread(t *testing.T) {
+ // This test can't run parallel as files in / might by changed by other tests.
+
requestHandler := FSHandler(".", 0)
f, err := os.Open(".")
@@ -650,6 +634,8 @@ func TestFSHandlerSingleThread(t *testing.T) {
}
func TestFSHandlerConcurrent(t *testing.T) {
+ // This test can't run parallel as files in / might by changed by other tests.
+
requestHandler := FSHandler(".", 0)
f, err := os.Open(".")
@@ -796,7 +782,7 @@ func testFileExtension(t *testing.T, path string, compressed bool, compressedFil
}
func TestServeFileContentType(t *testing.T) {
- t.Parallel()
+ // This test can't run parallel as files in / might by changed by other tests.
var ctx RequestCtx
var req Request