diff options
author | Erik Dubbelboer <erik@dubbelboer.com> | 2021-09-05 10:45:21 +0200 |
---|---|---|
committer | Erik Dubbelboer <erik@dubbelboer.com> | 2021-09-05 10:45:21 +0200 |
commit | 3f70d780be53be428ca38c4c75bfb0574e5d47d6 (patch) | |
tree | bf38f68a15bf0c4af47f7512c14861ae0806315b /fs_test.go | |
parent | compatible with new build tag (#1087) (diff) | |
download | fasthttp-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.go | 30 |
1 files changed, 8 insertions, 22 deletions
@@ -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 |