MCPcopy
hub / github.com/cortexlabs/cortex / TestBreakerUpdateConcurrency

Function TestBreakerUpdateConcurrency

pkg/proxy/breaker_test.go:232–244  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

230}
231
232func TestBreakerUpdateConcurrency(t *testing.T) {
233 params := BreakerParams{QueueDepth: 1, MaxConcurrency: 1, InitialCapacity: 0}
234 b := NewBreaker(params)
235 b.UpdateConcurrency(1)
236 if got, want := b.Capacity(), 1; got != want {
237 t.Errorf("Capacity() = %d, want: %d", got, want)
238 }
239
240 b.UpdateConcurrency(0)
241 if got, want := b.Capacity(), 0; got != want {
242 t.Errorf("Capacity() = %d, want: %d", got, want)
243 }
244}
245
246// Test empty semaphore, token cannot be acquired
247func TestSemaphoreAcquireHasNoCapacity(t *testing.T) {

Callers

nothing calls this directly

Calls 4

UpdateConcurrencyMethod · 0.95
CapacityMethod · 0.95
NewBreakerFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected