From 929283702a6a82163906e624f965b934e3b8074e Mon Sep 17 00:00:00 2001 From: Stanislav Chzhen Date: Tue, 15 Oct 2024 14:30:00 +0300 Subject: [PATCH] client: imp tests --- internal/client/storage_test.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/client/storage_test.go b/internal/client/storage_test.go index ed634444..a2101013 100644 --- a/internal/client/storage_test.go +++ b/internal/client/storage_test.go @@ -21,8 +21,10 @@ import ( "github.com/stretchr/testify/require" ) -// testStorage is a helper function that returns initialized storage. -func testStorage(tb testing.TB) (s *client.Storage) { +// newTestStorage is a helper function that returns initialized storage. +func newTestStorage(tb testing.TB) (s *client.Storage) { + tb.Helper() + ctx := testutil.ContextWithTimeout(tb, testTimeout) s, err := client.NewStorage(ctx, &client.StorageConfig{ Logger: slogutil.NewDiscardLogger(), @@ -582,7 +584,7 @@ func TestStorage_Add(t *testing.T) { } ctx := testutil.ContextWithTimeout(t, testTimeout) - s := testStorage(t) + s := newTestStorage(t) tags := s.AllowedTags() require.NotZero(t, len(tags)) require.True(t, slices.IsSorted(tags)) @@ -713,7 +715,7 @@ func TestStorage_RemoveByName(t *testing.T) { } ctx := testutil.ContextWithTimeout(t, testTimeout) - s := testStorage(t) + s := newTestStorage(t) err := s.Add(ctx, existingClient) require.NoError(t, err) @@ -738,7 +740,7 @@ func TestStorage_RemoveByName(t *testing.T) { } t.Run("duplicate_remove", func(t *testing.T) { - s = testStorage(t) + s = newTestStorage(t) err = s.Add(ctx, existingClient) require.NoError(t, err)