Fix datarace in writecache tests #548

Merged
fyrchik merged 2 commits from fyrchik/frostfs-node:fix-writecache into master 2023-07-29 10:57:27 +00:00

View file

@ -64,8 +64,9 @@ func TestFlush(t *testing.T) {
WithMetabase(mb), WithMetabase(mb),
WithBlobstor(bs), WithBlobstor(bs),
}, opts...)...) }, opts...)...)
t.Cleanup(func() { require.NoError(t, wc.Close()) })
require.NoError(t, wc.Open(false)) require.NoError(t, wc.Open(false))
initWC(t, wc) require.NoError(t, wc.Init())
// First set mode for metabase and blobstor to prevent background flushes. // First set mode for metabase and blobstor to prevent background flushes.
require.NoError(t, mb.SetMode(mode.ReadOnly)) require.NoError(t, mb.SetMode(mode.ReadOnly))
@ -229,10 +230,6 @@ func newObject(t *testing.T, size int) (*objectSDK.Object, []byte) {
return obj, data return obj, data
} }
func initWC(t *testing.T, wc Cache) {
require.NoError(t, wc.Init())
}
type dummyEpoch struct{} type dummyEpoch struct{}
func (dummyEpoch) CurrentEpoch() uint64 { func (dummyEpoch) CurrentEpoch() uint64 {