MCPcopy
hub / github.com/valyala/fasthttp / TestFSFSCompressConcurrent

Function TestFSFSCompressConcurrent

fs_fs_test.go:362–403  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

360}
361
362func TestFSFSCompressConcurrent(t *testing.T) {
363 t.Parallel()
364 // go 1.16 timeout may occur
365 if strings.HasPrefix(runtime.Version(), "go1.16") {
366 t.SkipNow()
367 }
368
369 stop := make(chan struct{})
370 defer close(stop)
371
372 fs := &FS{
373 FS: fsTestFilesystem,
374 Root: ".",
375 GenerateIndexPages: true,
376 Compress: true,
377 CompressBrotli: true,
378 CompressZstd: true,
379 CleanStop: stop,
380 }
381 h := fs.NewRequestHandler()
382
383 concurrency := 4
384 ch := make(chan struct{}, concurrency)
385 for range concurrency {
386 go func() {
387 for range 5 {
388 testFSFSCompress(t, h, "/fs.go")
389 testFSFSCompress(t, h, "/examples/")
390 testFSFSCompress(t, h, "/README.md")
391 }
392 ch <- struct{}{}
393 }()
394 }
395
396 for range concurrency {
397 select {
398 case <-ch:
399 case <-time.After(time.Second * 4):
400 t.Fatalf("timeout")
401 }
402 }
403}
404
405func TestFSFSCompressSingleThread(t *testing.T) {
406 t.Parallel()

Callers

nothing calls this directly

Calls 2

NewRequestHandlerMethod · 0.95
testFSFSCompressFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…