frostfs-node/pkg/local_object_storage/pilorama/mode_test.go

32 lines
761 B
Go
Raw Normal View History

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())
}