mirror of
https://github.com/redis/go-redis.git
synced 2025-10-21 20:53:41 +03:00
fix mocks
This commit is contained in:
@@ -10,12 +10,13 @@ import (
|
||||
|
||||
// TestHook for testing hook functionality
|
||||
type TestHook struct {
|
||||
OnGetCalled int
|
||||
OnPutCalled int
|
||||
GetError error
|
||||
PutError error
|
||||
ShouldPool bool
|
||||
ShouldRemove bool
|
||||
OnGetCalled int
|
||||
OnPutCalled int
|
||||
OnRemoveCalled int
|
||||
GetError error
|
||||
PutError error
|
||||
ShouldPool bool
|
||||
ShouldRemove bool
|
||||
}
|
||||
|
||||
func (th *TestHook) OnGet(ctx context.Context, conn *Conn, isNewConn bool) error {
|
||||
@@ -28,6 +29,10 @@ func (th *TestHook) OnPut(ctx context.Context, conn *Conn) (shouldPool bool, sho
|
||||
return th.ShouldPool, th.ShouldRemove, th.PutError
|
||||
}
|
||||
|
||||
func (th *TestHook) OnRemove(ctx context.Context, conn *Conn, reason error) {
|
||||
th.OnRemoveCalled++
|
||||
}
|
||||
|
||||
func TestPoolHookManager(t *testing.T) {
|
||||
manager := NewPoolHookManager()
|
||||
|
||||
|
@@ -92,6 +92,10 @@ func (mp *mockPool) Stats() *pool.Stats {
|
||||
return &pool.Stats{}
|
||||
}
|
||||
|
||||
func (mp *mockPool) Size() int {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (mp *mockPool) AddPoolHook(hook pool.PoolHook) {
|
||||
// Mock implementation - do nothing
|
||||
}
|
||||
|
Reference in New Issue
Block a user