From 0e10cd7cd27743124d0463a3c9bb2a0dfe3a0c37 Mon Sep 17 00:00:00 2001 From: Nedyalko Dyakov Date: Fri, 17 Oct 2025 13:57:13 +0300 Subject: [PATCH] fix mocks --- internal/pool/hooks_test.go | 17 +++++++++++------ maintnotifications/pool_hook_test.go | 4 ++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/internal/pool/hooks_test.go b/internal/pool/hooks_test.go index e6100115..2a14c9c2 100644 --- a/internal/pool/hooks_test.go +++ b/internal/pool/hooks_test.go @@ -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() diff --git a/maintnotifications/pool_hook_test.go b/maintnotifications/pool_hook_test.go index c689179d..f2f4f433 100644 --- a/maintnotifications/pool_hook_test.go +++ b/maintnotifications/pool_hook_test.go @@ -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 }