aboutsummaryrefslogtreecommitdiff
path: root/fs_test.go
diff options
context:
space:
mode:
authorGravatar Erik Dubbelboer <erik@dubbelboer.com> 2021-02-06 10:22:14 +0100
committerGravatar GitHub <noreply@github.com> 2021-02-06 10:22:14 +0100
commit3cec26d42db0529f14e82115515c9731ead2dd78 (patch)
treedcac50a16051b55efa1450fbd251979d27aa7424 /fs_test.go
parentFix race condition in Client.DoTimeout (diff)
downloadfasthttp-3cec26d42db0529f14e82115515c9731ead2dd78.tar.gz
fasthttp-3cec26d42db0529f14e82115515c9731ead2dd78.tar.bz2
fasthttp-3cec26d42db0529f14e82115515c9731ead2dd78.zip
Allow stopping FS handler cleanup gorountine (#942)
* Allow stopping FS handler cleanup gorountine * CleanStop
Diffstat (limited to 'fs_test.go')
-rw-r--r--fs_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/fs_test.go b/fs_test.go
index 8465ff8..01f8849 100644
--- a/fs_test.go
+++ b/fs_test.go
@@ -70,9 +70,13 @@ func testPathNotFound(t *testing.T, pathNotFoundFunc RequestHandler) {
req.SetRequestURI("http//some.url/file")
ctx.Init(&req, nil, TestLogger{t})
+ stop := make(chan struct{})
+ defer close(stop)
+
fs := &FS{
Root: "./",
PathNotFound: pathNotFoundFunc,
+ CleanStop: stop,
}
fs.NewRequestHandler()(&ctx)
@@ -299,9 +303,13 @@ func TestServeFileUncompressed(t *testing.T) {
func TestFSByteRangeConcurrent(t *testing.T) {
t.Parallel()
+ stop := make(chan struct{})
+ defer close(stop)
+
fs := &FS{
Root: ".",
AcceptByteRange: true,
+ CleanStop: stop,
}
h := fs.NewRequestHandler()
@@ -329,9 +337,13 @@ func TestFSByteRangeConcurrent(t *testing.T) {
func TestFSByteRangeSingleThread(t *testing.T) {
t.Parallel()
+ stop := make(chan struct{})
+ defer close(stop)
+
fs := &FS{
Root: ".",
AcceptByteRange: true,
+ CleanStop: stop,
}
h := fs.NewRequestHandler()
@@ -468,11 +480,15 @@ func testParseByteRangeError(t *testing.T, v string, contentLength int) {
func TestFSCompressConcurrent(t *testing.T) {
// This test can't run parallel as files in / might by changed by other tests.
+ stop := make(chan struct{})
+ defer close(stop)
+
fs := &FS{
Root: ".",
GenerateIndexPages: true,
Compress: true,
CompressBrotli: true,
+ CleanStop: stop,
}
h := fs.NewRequestHandler()
@@ -501,11 +517,15 @@ func TestFSCompressConcurrent(t *testing.T) {
func TestFSCompressSingleThread(t *testing.T) {
// This test can't run parallel as files in / might by changed by other tests.
+ stop := make(chan struct{})
+ defer close(stop)
+
fs := &FS{
Root: ".",
GenerateIndexPages: true,
Compress: true,
CompressBrotli: true,
+ CleanStop: stop,
}
h := fs.NewRequestHandler()