(t *testing.T)
| 360 | } |
| 361 | |
| 362 | func 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 | |
| 405 | func TestFSFSCompressSingleThread(t *testing.T) { |
| 406 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…