[#668] shard/test: Release shard in t.Cleanup()

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-09-06 17:18:04 +03:00 committed by Evgenii Stratonikov
parent 382eb8a485
commit 429f941cda
6 changed files with 3 additions and 7 deletions

View file

@ -31,10 +31,12 @@ func (s epochState) CurrentEpoch() uint64 {
}
func newShard(t testing.TB, enableWriteCache bool) *Shard {
return newCustomShard(t, t.TempDir(), enableWriteCache,
sh := newCustomShard(t, t.TempDir(), enableWriteCache,
writecacheconfig.Options{Type: writecacheconfig.TypeBBolt},
nil,
nil)
t.Cleanup(func() { releaseShard(sh, t) })
return sh
}
func newCustomShard(t testing.TB, rootPath string, enableWriteCache bool, wcOpts writecacheconfig.Options, bsOpts []blobstor.Option, metaOptions []meta.Option) *Shard {