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

Function TestBreakerQueueing

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

Source from the content-addressed store, hash-verified

136}
137
138func TestBreakerQueueing(t *testing.T) {
139 params := BreakerParams{QueueDepth: 2, MaxConcurrency: 1, InitialCapacity: 0}
140 b := NewBreaker(params) // Breaker capacity = 2
141 reqs := newRequestor(b)
142
143 // Bring breaker to capacity. Doesn't error because queue subsumes these requests.
144 reqs.request()
145 reqs.request()
146
147 // Update concurrency to allow the requests to be processed.
148 b.UpdateConcurrency(1)
149
150 // They should pass just fine.
151 reqs.processSuccessfully(t)
152 reqs.processSuccessfully(t)
153}
154
155func TestBreakerInflight(t *testing.T) {
156 params := BreakerParams{QueueDepth: 2, MaxConcurrency: 1, InitialCapacity: 1}

Callers

nothing calls this directly

Calls 5

UpdateConcurrencyMethod · 0.95
NewBreakerFunction · 0.85
newRequestorFunction · 0.85
requestMethod · 0.80
processSuccessfullyMethod · 0.80

Tested by

no test coverage detected