package fs import ( "bytes" "io" "path/filepath" "testing" "forge.cadoles.com/arcad/edge/pkg/storage/driver/cache/lfu" "forge.cadoles.com/arcad/edge/pkg/storage/driver/cache/lfu/testsuite" "github.com/pkg/errors" ) func TestCacheWithFSStore(t *testing.T) { testsuite.TestCacheWithStore(t, func(testName string) lfu.Store[string, string] { dir := filepath.Join("testdata", "testsuite", testName) store := NewStore[string, string](dir, WithMarshalValue[string, string](func(value string) (io.Reader, error) { return bytes.NewBuffer([]byte(value)), nil }), WithUnmarshalValue[string, string](func(r io.Reader) (string, error) { data, err := io.ReadAll(r) if err != nil { return "", errors.WithStack(err) } return string(data), nil }), ) if err := store.Clear(); err != nil { panic(errors.WithStack(err)) } return store }) }