locker_test.go — fiber Source File
Architecture documentation for locker_test.go, a go file in the fiber codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 40783155_a178_0f0d_045d_88e980e329eb["locker_test.go"] 51db452a_438a_4ccc_a0d4_94c26533ea58["strconv"] 40783155_a178_0f0d_045d_88e980e329eb --> 51db452a_438a_4ccc_a0d4_94c26533ea58 style 40783155_a178_0f0d_045d_88e980e329eb fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
package idempotency_test
import (
"strconv"
"sync/atomic"
"testing"
"time"
"github.com/gofiber/fiber/v3/middleware/idempotency"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
// go test -run Test_MemoryLock
func Test_MemoryLock(t *testing.T) {
t.Parallel()
l := idempotency.NewMemoryLock()
// Test that a lock can be acquired
{
err := l.Lock("a")
require.NoError(t, err)
}
// Test that the same lock cannot be acquired again while held
{
done := make(chan struct{})
go func() {
defer close(done)
err := l.Lock("a")
assert.NoError(t, err)
}()
select {
case <-done:
t.Fatal("lock acquired again")
case <-time.After(time.Second):
// Expected: goroutine should still be blocked
}
}
// Release lock "a" to prevent goroutine leak
{
err := l.Unlock("a")
require.NoError(t, err)
}
// Test lock and unlock sequence
{
err := l.Lock("b")
require.NoError(t, err)
}
{
err := l.Unlock("b")
require.NoError(t, err)
}
{
// ... (91 more lines)
Domain
Subdomains
Classes
Dependencies
- strconv
Source
Frequently Asked Questions
What does locker_test.go do?
locker_test.go is a source file in the fiber codebase, written in go. It belongs to the FiberCore domain, Adapters subdomain.
What functions are defined in locker_test.go?
locker_test.go defines 3 function(s): Benchmark_MemoryLock, Benchmark_MemoryLock_Parallel, Test_MemoryLock.
What does locker_test.go depend on?
locker_test.go imports 1 module(s): strconv.
Where is locker_test.go in the architecture?
locker_test.go is located at middleware/idempotency/locker_test.go (domain: FiberCore, subdomain: Adapters, directory: middleware/idempotency).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free