MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / TestLimiter_TryAck2

Function TestLimiter_TryAck2

internal/utils/fs/limiter_test.go:80–102  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

78}
79
80func TestLimiter_TryAck2(t *testing.T) {
81 if !testutils.IsSingleTesting() {
82 return
83 }
84
85 var a = assert.NewAssertion(t)
86
87 {
88 var limiter = fsutils.NewLimiter(4)
89 var count = limiter.FreeThreads()
90 a.IsTrue(count == 4)
91 for i := 0; i < count-1; i++ {
92 limiter.Ack()
93 }
94 a.IsTrue(limiter.FreeThreads() == 1)
95 a.IsTrue(limiter.TryAck())
96 a.IsFalse(limiter.TryAck())
97 a.IsFalse(limiter.TryAck())
98
99 limiter.Release()
100 a.IsTrue(limiter.TryAck())
101 }
102}
103
104func TestLimiter_Timout(t *testing.T) {
105 var timeout = time.NewTimer(100 * time.Millisecond)

Callers

nothing calls this directly

Calls 5

IsSingleTestingFunction · 0.92
FreeThreadsMethod · 0.80
TryAckMethod · 0.80
AckMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected