diff --git a/pkg/solana/internal/loader_test.go b/pkg/solana/internal/loader_test.go index 7fc8e0745..8d17a27ea 100644 --- a/pkg/solana/internal/loader_test.go +++ b/pkg/solana/internal/loader_test.go @@ -16,31 +16,18 @@ func (t *testLoader) load() (any, error) { return nil, nil } -func newTestLoader(lazyLoad bool) *testLoader { +func newTestLoader() *testLoader { loader := testLoader{} - loader.Loader = NewLoader[any](lazyLoad, loader.load) + loader.Loader = NewLoader[any](loader.load) return &loader } func TestLoader(t *testing.T) { t.Run("direct loading", func(t *testing.T) { - loader := newTestLoader(false) + loader := newTestLoader() _, _ = loader.Get() _, _ = loader.Get() _, _ = loader.Get() require.Equal(t, 3, loader.callCount) }) - - t.Run("lazy loading", func(t *testing.T) { - loader := newTestLoader(true) - _, _ = loader.Get() - _, _ = loader.Get() - require.Equal(t, 1, loader.callCount) - - // Calls load function again after Reset() - loader.Reset() - _, _ = loader.Get() - _, _ = loader.Get() - require.Equal(t, 2, loader.callCount) - }) } diff --git a/pkg/solana/monitor/balance_test.go b/pkg/solana/monitor/balance_test.go index 6f6bd03b9..a6cc231c9 100644 --- a/pkg/solana/monitor/balance_test.go +++ b/pkg/solana/monitor/balance_test.go @@ -63,10 +63,9 @@ func TestBalanceMonitor(t *testing.T) { } } - getClient := func() (BalanceClient, error) { + b.reader = internal.NewLoader[BalanceClient](func() (BalanceClient, error) { return client, nil - } - b.reader = internal.NewLoader[BalanceClient](true, getClient) + }) servicetest.Run(t, b) select {