MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / TestLocker_WaitLock_Success

Function TestLocker_WaitLock_Success

internal/lock/lock_test.go:102–111  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

100}
101
102func TestLocker_WaitLock_Success(t *testing.T) {
103 db, mock := redismock.NewClientMock()
104 locker := NewLocker(db, "test-key", "test-value")
105
106 mock.ExpectSetNX("test-key", "test-value", 5*time.Second).SetVal(true)
107
108 err := locker.WaitLock(context.Background(), 5*time.Second, 2*time.Second)
109 assert.NoError(t, err)
110 assert.NoError(t, mock.ExpectationsWereMet())
111}
112
113func TestLocker_WaitLock_ContextCanceled(t *testing.T) {
114 db, mock := redismock.NewClientMock()

Callers

nothing calls this directly

Calls 2

WaitLockMethod · 0.95
NewLockerFunction · 0.85

Tested by

no test coverage detected