forked from TrueCloudLab/frostfs-node
[#667] writecache: Add logs for report error func in tests
Signed-off-by: Airat Arifullin a.arifullin@yadro.comtraceid
parent
10570fc035
commit
3889e829e6
|
@ -14,9 +14,12 @@ import (
|
|||
oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test"
|
||||
"github.com/dgraph-io/badger/v4"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func TestFlush(t *testing.T) {
|
||||
testlogger := test.NewLogger(t, true)
|
||||
|
||||
createCacheFn := func(t *testing.T, smallSize uint64, mb *meta.DB, bs writecache.MainStorage, opts ...Option) writecache.Cache {
|
||||
return New(
|
||||
append([]Option{
|
||||
|
@ -30,8 +33,9 @@ func TestFlush(t *testing.T) {
|
|||
|
||||
errCountOpt := func() (Option, *atomic.Uint32) {
|
||||
cnt := &atomic.Uint32{}
|
||||
return WithReportErrorFunc(func(string, error) {
|
||||
return WithReportErrorFunc(func(msg string, err error) {
|
||||
cnt.Add(1)
|
||||
testlogger.Warn(msg, zap.Uint32("error_count", cnt.Load()), zap.Error(err))
|
||||
}), cnt
|
||||
}
|
||||
|
||||
|
|
|
@ -17,13 +17,16 @@ import (
|
|||
oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.etcd.io/bbolt"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func TestFlush(t *testing.T) {
|
||||
testlogger := test.NewLogger(t, true)
|
||||
|
||||
createCacheFn := func(t *testing.T, smallSize uint64, mb *meta.DB, bs writecache.MainStorage, opts ...Option) writecache.Cache {
|
||||
return New(
|
||||
append([]Option{
|
||||
WithLogger(test.NewLogger(t, true)),
|
||||
WithLogger(testlogger),
|
||||
WithPath(filepath.Join(t.TempDir(), "writecache")),
|
||||
WithSmallObjectSize(smallSize),
|
||||
WithMetabase(mb),
|
||||
|
@ -33,8 +36,9 @@ func TestFlush(t *testing.T) {
|
|||
|
||||
errCountOpt := func() (Option, *atomic.Uint32) {
|
||||
cnt := &atomic.Uint32{}
|
||||
return WithReportErrorFunc(func(string, error) {
|
||||
return WithReportErrorFunc(func(msg string, err error) {
|
||||
cnt.Add(1)
|
||||
testlogger.Warn(msg, zap.Uint32("error_count", cnt.Load()), zap.Error(err))
|
||||
}), cnt
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue