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

Function TestSemaphoreRelease

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

Source from the content-addressed store, hash-verified

292}
293
294func TestSemaphoreRelease(t *testing.T) {
295 sem := newSemaphore(1, 1)
296 sem.acquire(context.Background())
297 func() {
298 defer func() {
299 if e := recover(); e != nil {
300 t.Error("Expected no panic, got message:", e)
301 }
302 sem.release()
303 }()
304 }()
305 func() {
306 defer func() {
307 if e := recover(); e == nil {
308 t.Error("Expected panic, but got none")
309 }
310 }()
311 sem.release()
312 }()
313}
314
315func TestSemaphoreUpdateCapacity(t *testing.T) {
316 const initialCapacity = 1

Callers

nothing calls this directly

Calls 4

newSemaphoreFunction · 0.85
acquireMethod · 0.80
ErrorMethod · 0.80
releaseMethod · 0.80

Tested by

no test coverage detected