[#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

@ -62,9 +62,7 @@ func TestLockUserScenario(t *testing.T) {
require.NoError(t, e.Open(context.Background()))
require.NoError(t, e.Init(context.Background()))
t.Cleanup(func() {
_ = e.Close(context.Background())
})
defer func() { require.NoError(t, e.Close(context.Background())) }()
lockerID := oidtest.ID()
tombID := oidtest.ID()
@ -169,9 +167,7 @@ func TestLockExpiration(t *testing.T) {
require.NoError(t, e.Open(context.Background()))
require.NoError(t, e.Init(context.Background()))
t.Cleanup(func() {
_ = e.Close(context.Background())
})
defer func() { require.NoError(t, e.Close(context.Background())) }()
const lockerExpiresAfter = 13
@ -246,9 +242,7 @@ func TestLockForceRemoval(t *testing.T) {
}).engine
require.NoError(t, e.Open(context.Background()))
require.NoError(t, e.Init(context.Background()))
t.Cleanup(func() {
_ = e.Close(context.Background())
})
defer func() { require.NoError(t, e.Close(context.Background())) }()
cnr := cidtest.ID()
var err error