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

Function TestLocker_Lock_Success

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

Source from the content-addressed store, hash-verified

26)
27
28func TestLocker_Lock_Success(t *testing.T) {
29 db, mock := redismock.NewClientMock()
30 locker := NewLocker(db, "test-key", "test-value")
31
32 mock.ExpectSetNX("test-key", "test-value", 5*time.Second).SetVal(true)
33
34 err := locker.Lock(context.Background(), 5*time.Second)
35 assert.NoError(t, err)
36 assert.NoError(t, mock.ExpectationsWereMet())
37}
38
39func TestLocker_Lock_Failure(t *testing.T) {
40 db, mock := redismock.NewClientMock()

Callers

nothing calls this directly

Calls 2

LockMethod · 0.95
NewLockerFunction · 0.85

Tested by

no test coverage detected