Files
restic/internal/backend/cache/testing.go
T
2026-06-10 22:45:39 +02:00

22 lines
463 B
Go

package cache
import (
"testing"
"github.com/restic/restic/internal/test"
)
const testCacheID = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
// TestNewCache returns a cache in a temporary directory which is removed when
// cleanup is called.
func TestNewCache(t testing.TB) *Cache {
dir := test.TempDir(t)
t.Logf("created new cache at %v", dir)
cache, err := New(testCacheID, dir)
if err != nil {
t.Fatal(err)
}
return cache
}