forked from TrueCloudLab/frostfs-node
[#1686] local_object_storage: Add generic tests
Use them for writecache as a simple example. Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
parent
bc20851cd1
commit
b8b9d25f9d
3 changed files with 169 additions and 8 deletions
29
pkg/local_object_storage/writecache/generic_test.go
Normal file
29
pkg/local_object_storage/writecache/generic_test.go
Normal file
|
@ -0,0 +1,29 @@
|
|||
package writecache
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/internal/storagetest"
|
||||
"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(
|
||||
WithLogger(zaptest.NewLogger(t)),
|
||||
WithFlushWorkersCount(2),
|
||||
WithPath(dir))
|
||||
}
|
||||
|
||||
storagetest.TestAll(t, newCache)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue