[#1437] node: Fix contextcheck linter

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2024-10-21 16:27:28 +03:00
parent 6921a89061
commit 7429553266
Signed by: dstepanov-yadro
GPG key ID: 237AF1A763293BC0
209 changed files with 1068 additions and 1036 deletions

View file

@ -38,9 +38,9 @@ func TestFlush(t *testing.T) {
errCountOpt := func() (Option, *atomic.Uint32) {
cnt := &atomic.Uint32{}
return WithReportErrorFunc(func(msg string, err error) {
return WithReportErrorFunc(func(ctx context.Context, msg string, err error) {
cnt.Add(1)
testlogger.Warn(context.Background(), msg, zap.Uint32("error_count", cnt.Load()), zap.Error(err))
testlogger.Warn(ctx, msg, zap.Uint32("error_count", cnt.Load()), zap.Error(err))
}), cnt
}
@ -114,7 +114,7 @@ func runFlushTest[Option any](
) {
t.Run("no errors", func(t *testing.T) {
wc, bs, mb := newCache(t, createCacheFn)
defer func() { require.NoError(t, wc.Close()) }()
defer func() { require.NoError(t, wc.Close(context.Background())) }()
objects := putObjects(t, wc)
require.NoError(t, bs.SetMode(context.Background(), mode.ReadWrite))
@ -127,7 +127,7 @@ func runFlushTest[Option any](
t.Run("flush on moving to degraded mode", func(t *testing.T) {
wc, bs, mb := newCache(t, createCacheFn)
defer func() { require.NoError(t, wc.Close()) }()
defer func() { require.NoError(t, wc.Close(context.Background())) }()
objects := putObjects(t, wc)
// Blobstor is read-only, so we expect en error from `flush` here.
@ -145,7 +145,7 @@ func runFlushTest[Option any](
t.Run(f.Desc, func(t *testing.T) {
errCountOpt, errCount := errCountOption()
wc, bs, mb := newCache(t, createCacheFn, errCountOpt)
defer func() { require.NoError(t, wc.Close()) }()
defer func() { require.NoError(t, wc.Close(context.Background())) }()
objects := putObjects(t, wc)
f.InjectFn(t, wc)
@ -173,7 +173,7 @@ func newCache[Option any](
meta.WithPath(filepath.Join(dir, "meta")),
meta.WithEpochState(dummyEpoch{}))
require.NoError(t, mb.Open(context.Background(), mode.ReadWrite))
require.NoError(t, mb.Init())
require.NoError(t, mb.Init(context.Background()))
bs := blobstor.New(blobstor.WithStorages([]blobstor.SubStorage{
{
@ -184,11 +184,11 @@ func newCache[Option any](
},
}))
require.NoError(t, bs.Open(context.Background(), mode.ReadWrite))
require.NoError(t, bs.Init())
require.NoError(t, bs.Init(context.Background()))
wc := createCacheFn(t, mb, bs, opts...)
require.NoError(t, wc.Open(context.Background(), mode.ReadWrite))
require.NoError(t, wc.Init())
require.NoError(t, wc.Init(context.Background()))
// First set mode for metabase and blobstor to prevent background flushes.
require.NoError(t, mb.SetMode(context.Background(), mode.ReadOnly))