2022-08-22 11:40:03 +00:00
|
|
|
package writecache
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
"strconv"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/internal/storagetest"
|
2022-09-28 07:41:01 +00:00
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
|
2022-08-22 11:40:03 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"go.uber.org/zap/zaptest"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestGeneric(t *testing.T) {
|
|
|
|
defer func() { _ = os.RemoveAll(t.Name()) }()
|
|
|
|
|
|
|
|
var n int
|
|
|
|
newCache := func(t *testing.T) storagetest.Component {
|
|
|
|
n++
|
|
|
|
dir := filepath.Join(t.Name(), strconv.Itoa(n))
|
|
|
|
require.NoError(t, os.MkdirAll(dir, os.ModePerm))
|
|
|
|
return New(
|
2022-09-28 07:41:01 +00:00
|
|
|
WithLogger(&logger.Logger{Logger: zaptest.NewLogger(t)}),
|
2022-08-22 11:40:03 +00:00
|
|
|
WithFlushWorkersCount(2),
|
|
|
|
WithPath(dir))
|
|
|
|
}
|
|
|
|
|
|
|
|
storagetest.TestAll(t, newCache)
|
|
|
|
}
|