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

Function TestBreakerInvalidConstructor

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

Source from the content-addressed store, hash-verified

39)
40
41func TestBreakerInvalidConstructor(t *testing.T) {
42 tests := []struct {
43 name string
44 options BreakerParams
45 }{{
46 name: "QueueDepth = 0",
47 options: BreakerParams{QueueDepth: 0, MaxConcurrency: 1, InitialCapacity: 1},
48 }, {
49 name: "MaxConcurrency negative",
50 options: BreakerParams{QueueDepth: 1, MaxConcurrency: -1, InitialCapacity: 1},
51 }, {
52 name: "InitialCapacity negative",
53 options: BreakerParams{QueueDepth: 1, MaxConcurrency: 1, InitialCapacity: -1},
54 }, {
55 name: "InitialCapacity out-of-bounds",
56 options: BreakerParams{QueueDepth: 1, MaxConcurrency: 5, InitialCapacity: 6},
57 }}
58
59 for _, test := range tests {
60 t.Run(test.name, func(t *testing.T) {
61 defer func() {
62 if r := recover(); r == nil {
63 t.Error("Expected a panic but the code didn't panic.")
64 }
65 }()
66
67 NewBreaker(test.options)
68 })
69 }
70}
71
72func TestBreakerReserveOverload(t *testing.T) {
73 params := BreakerParams{QueueDepth: 1, MaxConcurrency: 1, InitialCapacity: 1}

Callers

nothing calls this directly

Calls 2

NewBreakerFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected