(t *testing.T)
| 307 | } |
| 308 | |
| 309 | func TestFSFSByteRangeConcurrent(t *testing.T) { |
| 310 | t.Parallel() |
| 311 | |
| 312 | stop := make(chan struct{}) |
| 313 | defer close(stop) |
| 314 | |
| 315 | fs := &FS{ |
| 316 | FS: fsTestFilesystem, |
| 317 | Root: "", |
| 318 | AcceptByteRange: true, |
| 319 | CleanStop: stop, |
| 320 | } |
| 321 | h := fs.NewRequestHandler() |
| 322 | |
| 323 | concurrency := 10 |
| 324 | ch := make(chan struct{}, concurrency) |
| 325 | for range concurrency { |
| 326 | go func() { |
| 327 | for range 5 { |
| 328 | testFSByteRange(t, h, "/fs.go") |
| 329 | testFSByteRange(t, h, "/README.md") |
| 330 | } |
| 331 | ch <- struct{}{} |
| 332 | }() |
| 333 | } |
| 334 | |
| 335 | for range concurrency { |
| 336 | select { |
| 337 | case <-time.After(time.Second): |
| 338 | t.Fatalf("timeout") |
| 339 | case <-ch: |
| 340 | } |
| 341 | } |
| 342 | } |
| 343 | |
| 344 | func TestFSFSByteRangeSingleThread(t *testing.T) { |
| 345 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…