forked from TrueCloudLab/frostfs-node
32 lines
761 B
Go
32 lines
761 B
Go
|
package pilorama
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"path/filepath"
|
||
|
"testing"
|
||
|
|
||
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode"
|
||
|
"github.com/stretchr/testify/require"
|
||
|
)
|
||
|
|
||
|
func Test_Mode(t *testing.T) {
|
||
|
t.Parallel()
|
||
|
f := NewBoltForest(
|
||
|
[]Option{
|
||
|
WithPath(filepath.Join(t.TempDir(), "test.db")),
|
||
|
WithMaxBatchSize(1),
|
||
|
}...)
|
||
|
|
||
|
require.NoError(t, f.Open(context.Background(), mode.DegradedReadOnly))
|
||
|
require.Nil(t, f.(*boltForest).db)
|
||
|
require.NoError(t, f.Init())
|
||
|
require.Nil(t, f.(*boltForest).db)
|
||
|
require.NoError(t, f.Close())
|
||
|
|
||
|
require.NoError(t, f.Open(context.Background(), mode.Degraded))
|
||
|
require.Nil(t, f.(*boltForest).db)
|
||
|
require.NoError(t, f.Init())
|
||
|
require.Nil(t, f.(*boltForest).db)
|
||
|
require.NoError(t, f.Close())
|
||
|
}
|