2024-02-09 06:17:17 +00:00
|
|
|
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))
|
2024-09-09 15:37:06 +00:00
|
|
|
require.Nil(t, wc.(*cache).fsTree)
|
2024-02-09 06:17:17 +00:00
|
|
|
require.NoError(t, wc.Init())
|
2024-09-09 15:37:06 +00:00
|
|
|
require.Nil(t, wc.(*cache).fsTree)
|
2024-02-09 06:17:17 +00:00
|
|
|
require.NoError(t, wc.Close())
|
|
|
|
|
|
|
|
require.NoError(t, wc.Open(context.Background(), mode.Degraded))
|
2024-09-09 15:37:06 +00:00
|
|
|
require.Nil(t, wc.(*cache).fsTree)
|
2024-02-09 06:17:17 +00:00
|
|
|
require.NoError(t, wc.Init())
|
2024-09-09 15:37:06 +00:00
|
|
|
require.Nil(t, wc.(*cache).fsTree)
|
2024-02-09 06:17:17 +00:00
|
|
|
require.NoError(t, wc.Close())
|
|
|
|
}
|