[#895] test: Use t.Cleanup only for external resources

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2024-01-09 16:26:43 +03:00 committed by Evgenii Stratonikov
parent 836818fb75
commit 47dcfa20f3
50 changed files with 164 additions and 95 deletions

View file

@ -30,7 +30,6 @@ func (s epochState) CurrentEpoch() uint64 {
type shardOptions struct {
rootPath string
dontRelease bool
wcOpts []writecache.Option
bsOpts []blobstor.Option
metaOptions []meta.Option
@ -109,13 +108,5 @@ func newCustomShard(t testing.TB, enableWriteCache bool, o shardOptions) *Shard
require.NoError(t, sh.Open(context.Background()))
require.NoError(t, sh.Init(context.Background()))
if !o.dontRelease {
t.Cleanup(func() { releaseShard(sh, t) })
}
return sh
}
func releaseShard(s *Shard, t testing.TB) {
require.NoError(t, s.Close())
}