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

Function TestBreakerNoOverload

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

Source from the content-addressed store, hash-verified

169}
170
171func TestBreakerNoOverload(t *testing.T) {
172 params := BreakerParams{QueueDepth: 1, MaxConcurrency: 1, InitialCapacity: 1}
173 b := NewBreaker(params) // Breaker capacity = 2
174 reqs := newRequestor(b)
175
176 // Bring request to capacity.
177 reqs.request()
178 reqs.request()
179
180 // Process one, send a new one in, at capacity again.
181 reqs.processSuccessfully(t)
182 reqs.request()
183
184 // Process one, send a new one in, at capacity again.
185 reqs.processSuccessfully(t)
186 reqs.request()
187
188 // Process the remainder successfully.
189 reqs.processSuccessfully(t)
190 reqs.processSuccessfully(t)
191}
192
193func TestBreakerCancel(t *testing.T) {
194 params := BreakerParams{QueueDepth: 1, MaxConcurrency: 1, InitialCapacity: 0}

Callers

nothing calls this directly

Calls 4

NewBreakerFunction · 0.85
newRequestorFunction · 0.85
requestMethod · 0.80
processSuccessfullyMethod · 0.80

Tested by

no test coverage detected