(t *testing.T)
| 74 | } |
| 75 | |
| 76 | func TestLocker_ExtendLock_Success(t *testing.T) { |
| 77 | db, mock := redismock.NewClientMock() |
| 78 | locker := NewLocker(db, "test-key", "test-value") |
| 79 | |
| 80 | // Simulate successful lock extension |
| 81 | script := "if redis.call('get', KEYS[1]) == ARGV[1] then return redis.call('pexpire', KEYS[1], ARGV[2]) else return 0 end" |
| 82 | mock.ExpectEval(script, []string{"test-key"}, "test-value", "5000").SetVal(int64(1)) |
| 83 | |
| 84 | err := locker.ExtendLock(context.Background(), 5*time.Second) |
| 85 | assert.NoError(t, err) |
| 86 | assert.NoError(t, mock.ExpectationsWereMet()) |
| 87 | } |
| 88 | |
| 89 | func TestLocker_ExtendLock_Failure(t *testing.T) { |
| 90 | db, mock := redismock.NewClientMock() |
nothing calls this directly
no test coverage detected