github.com/ethersphere/bee/v2@v2.2.0/pkg/storage/cache/cache_test.go (about) 1 // Copyright 2023 The Swarm Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package cache_test 6 7 import ( 8 "testing" 9 10 "github.com/ethersphere/bee/v2/pkg/storage/cache" 11 "github.com/ethersphere/bee/v2/pkg/storage/leveldbstore" 12 "github.com/ethersphere/bee/v2/pkg/storage/storagetest" 13 "github.com/ethersphere/bee/v2/pkg/util/testutil" 14 ) 15 16 func TestCache(t *testing.T) { 17 t.Parallel() 18 19 store, err := leveldbstore.New(t.TempDir(), nil) 20 if err != nil { 21 t.Fatalf("create store failed: %v", err) 22 } 23 testutil.CleanupCloser(t, store) 24 25 cache, err := cache.Wrap(store, 100_000) 26 if err != nil { 27 t.Fatalf("create cache failed: %v", err) 28 } 29 30 storagetest.TestStore(t, cache) 31 }