| 123 | } |
| 124 | |
| 125 | func TestLocker_WaitLock_Failure(t *testing.T) { |
| 126 | db, mock := redismock.NewClientMock() |
| 127 | locker := NewLocker(db, "test-key", "test-value") |
| 128 | |
| 129 | err := locker.WaitLock(context.Background(), 5*time.Second, time.Nanosecond) |
| 130 | assert.ErrorIs(t, err, ErrLockWaitTimeout) |
| 131 | assert.EqualError(t, err, "failed to acquire lock for key test-key within the wait timeout") |
| 132 | assert.NoError(t, mock.ExpectationsWereMet()) |
| 133 | } |
| 134 | |
| 135 | func TestNewMultiLocker_SortsKeysLexicographically(t *testing.T) { |
| 136 | db, _ := redismock.NewClientMock() |