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

31 lines
879 B
Go
Raw Normal View History

package writecache
import (
"context"
"testing"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger/test"
"github.com/stretchr/testify/require"
)
func TestMode(t *testing.T) {
t.Parallel()
wc := New(
WithLogger(test.NewLogger(t)),
WithFlushWorkersCount(2),
WithPath(t.TempDir()))
require.NoError(t, wc.Open(context.Background(), mode.DegradedReadOnly))
require.Nil(t, wc.(*cache).fsTree)
require.NoError(t, wc.Init(context.Background()))
require.Nil(t, wc.(*cache).fsTree)
require.NoError(t, wc.Close(context.Background()))
require.NoError(t, wc.Open(context.Background(), mode.Degraded))
require.Nil(t, wc.(*cache).fsTree)
require.NoError(t, wc.Init(context.Background()))
require.Nil(t, wc.(*cache).fsTree)
require.NoError(t, wc.Close(context.Background()))
}