2022-01-20 02:40:32 +00:00
|
|
|
package files_test
|
2022-01-19 00:03:24 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2022-01-20 02:40:32 +00:00
|
|
|
"git.t-juice.club/torjus/gpaste/files"
|
2022-01-19 00:03:24 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestFSFileStore(t *testing.T) {
|
2022-01-24 22:18:13 +00:00
|
|
|
newFunc := func() files.FileStore {
|
|
|
|
dir := t.TempDir()
|
|
|
|
s, err := files.NewFSFileStore(dir)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Error creating store: %s", err)
|
|
|
|
}
|
|
|
|
return s
|
2022-01-19 00:03:24 +00:00
|
|
|
}
|
|
|
|
|
2022-01-24 22:18:13 +00:00
|
|
|
RunFilestoreTest(newFunc, t)
|
2022-01-19 02:10:50 +00:00
|
|
|
persistentDir := t.TempDir()
|
2022-01-24 22:18:13 +00:00
|
|
|
persistentFunc := func() files.FileStore {
|
2022-01-20 02:40:32 +00:00
|
|
|
s, err := files.NewFSFileStore(persistentDir)
|
2022-01-19 02:10:50 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Error creating store: %s", err)
|
|
|
|
}
|
|
|
|
return s
|
|
|
|
}
|
2022-01-24 22:18:13 +00:00
|
|
|
RunPersistentFilestoreTest(persistentFunc, t)
|
2022-01-19 00:03:24 +00:00
|
|
|
}
|