forked from TrueCloudLab/frostfs-node
[#895] test: Use t.Cleanup only for external resources
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
836818fb75
commit
47dcfa20f3
50 changed files with 164 additions and 95 deletions
|
@ -142,6 +142,7 @@ func runFlushTest[Option any](
|
|||
) {
|
||||
t.Run("no errors", func(t *testing.T) {
|
||||
wc, bs, mb := newCache(t, createCacheFn, smallSize)
|
||||
defer func() { require.NoError(t, wc.Close()) }()
|
||||
objects := putObjects(t, wc)
|
||||
|
||||
require.NoError(t, bs.SetMode(mode.ReadWrite))
|
||||
|
@ -154,6 +155,7 @@ func runFlushTest[Option any](
|
|||
|
||||
t.Run("flush on moving to degraded mode", func(t *testing.T) {
|
||||
wc, bs, mb := newCache(t, createCacheFn, smallSize)
|
||||
defer func() { require.NoError(t, wc.Close()) }()
|
||||
objects := putObjects(t, wc)
|
||||
|
||||
// Blobstor is read-only, so we expect en error from `flush` here.
|
||||
|
@ -172,6 +174,7 @@ func runFlushTest[Option any](
|
|||
t.Run(f.Desc, func(t *testing.T) {
|
||||
errCountOpt, errCount := errCountOption()
|
||||
wc, bs, mb := newCache(t, createCacheFn, smallSize, errCountOpt)
|
||||
defer func() { require.NoError(t, wc.Close()) }()
|
||||
objects := putObjects(t, wc)
|
||||
f.InjectFn(t, wc)
|
||||
|
||||
|
@ -214,7 +217,6 @@ func newCache[Option any](
|
|||
require.NoError(t, bs.Init())
|
||||
|
||||
wc := createCacheFn(t, smallSize, mb, bs, opts...)
|
||||
t.Cleanup(func() { require.NoError(t, wc.Close()) })
|
||||
require.NoError(t, wc.Open(context.Background(), false))
|
||||
require.NoError(t, wc.Init())
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue