Skip to content

Commit

Permalink
client: imp tests
Browse files Browse the repository at this point in the history
  • Loading branch information
schzhn committed Oct 15, 2024
1 parent f29d8ed commit 9292837
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions internal/client/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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)

Expand All @@ -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)

Expand Down

0 comments on commit 9292837

Please sign in to comment.