MCPcopy Create free account
hub / github.com/ContentSquare/chproxy / testConcurrent

Function testConcurrent

scope_test.go:240–256  ·  view source on GitHub ↗
(f func(), concurrency int)

Source from the content-addressed store, hash-verified

238}
239
240func testConcurrent(f func(), concurrency int) error {
241 ch := make(chan struct{}, concurrency)
242 for i := 0; i < concurrency; i++ {
243 go func() {
244 f()
245 ch <- struct{}{}
246 }()
247 }
248 for i := 0; i < concurrency; i++ {
249 select {
250 case <-ch:
251 case <-time.After(2 * time.Second):
252 return fmt.Errorf("timeout on %d iteration", i)
253 }
254 }
255 return nil
256}
257
258func TestDecorateRequest(t *testing.T) {
259 testCases := []struct {

Callers 3

TestGetHostConcurrentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected