2026-03-14 21:10:46 -04:00
|
|
|
package attachment
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"testing"
|
2026-03-25 15:28:23 -04:00
|
|
|
"time"
|
2026-03-14 21:10:46 -04:00
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
)
|
|
|
|
|
|
2026-03-21 21:59:59 -04:00
|
|
|
func newTestFileStore(t *testing.T, totalSizeLimit int64) (dir string, cache *Store) {
|
2026-03-17 20:53:41 -04:00
|
|
|
t.Helper()
|
2026-03-14 21:10:46 -04:00
|
|
|
dir = t.TempDir()
|
2026-03-25 15:28:23 -04:00
|
|
|
cache, err := NewFileStore(dir, totalSizeLimit, time.Hour, nil)
|
2026-03-14 21:10:46 -04:00
|
|
|
require.Nil(t, err)
|
2026-03-17 20:53:41 -04:00
|
|
|
t.Cleanup(func() { cache.Close() })
|
|
|
|
|
return dir, cache
|
2026-03-14 21:10:46 -04:00
|
|
|
}
|