2024-02-09 06:17:17 +00:00
|
|
|
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)
|
2024-10-21 13:27:28 +00:00
|
|
|
require.NoError(t, f.Init(context.Background()))
|
2024-02-09 06:17:17 +00:00
|
|
|
require.Nil(t, f.(*boltForest).db)
|
2024-10-21 13:27:28 +00:00
|
|
|
require.NoError(t, f.Close(context.Background()))
|
2024-02-09 06:17:17 +00:00
|
|
|
|
|
|
|
require.NoError(t, f.Open(context.Background(), mode.Degraded))
|
|
|
|
require.Nil(t, f.(*boltForest).db)
|
2024-10-21 13:27:28 +00:00
|
|
|
require.NoError(t, f.Init(context.Background()))
|
2024-02-09 06:17:17 +00:00
|
|
|
require.Nil(t, f.(*boltForest).db)
|
2024-10-21 13:27:28 +00:00
|
|
|
require.NoError(t, f.Close(context.Background()))
|
2024-02-09 06:17:17 +00:00
|
|
|
}
|