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

Function TestSemaphoreUpdateCapacity

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

Source from the content-addressed store, hash-verified

313}
314
315func TestSemaphoreUpdateCapacity(t *testing.T) {
316 const initialCapacity = 1
317 sem := newSemaphore(3, initialCapacity)
318 if got, want := sem.Capacity(), 1; got != want {
319 t.Errorf("Capacity = %d, want: %d", got, want)
320 }
321 sem.acquire(context.Background())
322 sem.updateCapacity(initialCapacity + 2)
323 if got, want := sem.Capacity(), 3; got != want {
324 t.Errorf("Capacity = %d, want: %d", got, want)
325 }
326}
327
328func TestPackUnpack(t *testing.T) {
329 wantL := uint64(256)

Callers

nothing calls this directly

Calls 5

newSemaphoreFunction · 0.85
ErrorfMethod · 0.80
acquireMethod · 0.80
updateCapacityMethod · 0.80
CapacityMethod · 0.45

Tested by

no test coverage detected