[#895] test: Fix NewLogger arguments list

`debug` is always true.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2024-01-09 11:37:41 +03:00 committed by Evgenii Stratonikov
parent a8e52ef7aa
commit f1b2b8bffa
32 changed files with 60 additions and 65 deletions

View file

@ -19,7 +19,7 @@ func TestEpochTimer(t *testing.T) {
} }
args := &epochTimerArgs{ args := &epochTimerArgs{
l: test.NewLogger(t, true), l: test.NewLogger(t),
alphabetState: alphaState, alphabetState: alphaState,
newEpochHandlers: []newEpochHandler{neh.Handle}, newEpochHandlers: []newEpochHandler{neh.Handle},
cnrWrapper: cnrStopper, cnrWrapper: cnrStopper,

View file

@ -48,7 +48,7 @@ func TestProcessorEmitsGasToNetmapAndAlphabet(t *testing.T) {
params := &alphabet.Params{ params := &alphabet.Params{
ParsedWallets: parsedWallets, ParsedWallets: parsedWallets,
Log: test.NewLogger(t, true), Log: test.NewLogger(t),
PoolSize: 2, PoolSize: 2,
StorageEmission: emission, StorageEmission: emission,
IRList: &testIndexer{index: index}, IRList: &testIndexer{index: index},
@ -125,7 +125,7 @@ func TestProcessorEmitsGasToNetmapIfNoParsedWallets(t *testing.T) {
params := &alphabet.Params{ params := &alphabet.Params{
ParsedWallets: parsedWallets, ParsedWallets: parsedWallets,
Log: test.NewLogger(t, true), Log: test.NewLogger(t),
PoolSize: 2, PoolSize: 2,
StorageEmission: emission, StorageEmission: emission,
IRList: &testIndexer{index: index}, IRList: &testIndexer{index: index},
@ -186,7 +186,7 @@ func TestProcessorDoesntEmitGasIfNoNetmapOrParsedWallets(t *testing.T) {
params := &alphabet.Params{ params := &alphabet.Params{
ParsedWallets: parsedWallets, ParsedWallets: parsedWallets,
Log: test.NewLogger(t, true), Log: test.NewLogger(t),
PoolSize: 2, PoolSize: 2,
StorageEmission: emission, StorageEmission: emission,
IRList: &testIndexer{index: index}, IRList: &testIndexer{index: index},

View file

@ -21,7 +21,7 @@ func TestProcessorCallsFrostFSContractForLockEvent(t *testing.T) {
bsc := util.Uint160{100} bsc := util.Uint160{100}
processor, err := New(&Params{ processor, err := New(&Params{
Log: test.NewLogger(t, true), Log: test.NewLogger(t),
PoolSize: 2, PoolSize: 2,
FrostFSClient: cl, FrostFSClient: cl,
BalanceSC: bsc, BalanceSC: bsc,
@ -47,7 +47,7 @@ func TestProcessorDoesntCallFrostFSContractIfNotAlphabet(t *testing.T) {
bsc := util.Uint160{100} bsc := util.Uint160{100}
processor, err := New(&Params{ processor, err := New(&Params{
Log: test.NewLogger(t, true), Log: test.NewLogger(t),
PoolSize: 2, PoolSize: 2,
FrostFSClient: cl, FrostFSClient: cl,
BalanceSC: bsc, BalanceSC: bsc,

View file

@ -38,7 +38,7 @@ func TestPutEvent(t *testing.T) {
mc := &testMorphClient{} mc := &testMorphClient{}
proc, err := New(&Params{ proc, err := New(&Params{
Log: test.NewLogger(t, true), Log: test.NewLogger(t),
PoolSize: 2, PoolSize: 2,
AlphabetState: &testAlphabetState{isAlphabet: true}, AlphabetState: &testAlphabetState{isAlphabet: true},
NetworkState: nst, NetworkState: nst,
@ -99,7 +99,7 @@ func TestDeleteEvent(t *testing.T) {
mc := &testMorphClient{} mc := &testMorphClient{}
proc, err := New(&Params{ proc, err := New(&Params{
Log: test.NewLogger(t, true), Log: test.NewLogger(t),
PoolSize: 2, PoolSize: 2,
AlphabetState: &testAlphabetState{isAlphabet: true}, AlphabetState: &testAlphabetState{isAlphabet: true},
NetworkState: nst, NetworkState: nst,
@ -171,7 +171,7 @@ func TestSetEACLEvent(t *testing.T) {
mc := &testMorphClient{} mc := &testMorphClient{}
proc, err := New(&Params{ proc, err := New(&Params{
Log: test.NewLogger(t, true), Log: test.NewLogger(t),
PoolSize: 2, PoolSize: 2,
AlphabetState: &testAlphabetState{isAlphabet: true}, AlphabetState: &testAlphabetState{isAlphabet: true},
NetworkState: nst, NetworkState: nst,

View file

@ -193,7 +193,7 @@ func TestHandleConfig(t *testing.T) {
func newTestProc(t *testing.T, nonDefault func(p *Params)) (*Processor, error) { func newTestProc(t *testing.T, nonDefault func(p *Params)) (*Processor, error) {
p := &Params{ p := &Params{
Log: test.NewLogger(t, true), Log: test.NewLogger(t),
PoolSize: 1, PoolSize: 1,
FrostFSContract: util.Uint160{0}, FrostFSContract: util.Uint160{0},
BalanceClient: &testBalaceClient{}, BalanceClient: &testBalaceClient{},

View file

@ -42,7 +42,7 @@ func TestHandleAlphabetSyncEvent(t *testing.T) {
proc, err := New( proc, err := New(
&Params{ &Params{
Log: test.NewLogger(t, true), Log: test.NewLogger(t),
EpochState: es, EpochState: es,
AlphabetState: as, AlphabetState: as,
Voter: v, Voter: v,
@ -123,7 +123,7 @@ func TestHandleAlphabetDesignateEvent(t *testing.T) {
proc, err := New( proc, err := New(
&Params{ &Params{
Log: test.NewLogger(t, true), Log: test.NewLogger(t),
EpochState: es, EpochState: es,
AlphabetState: as, AlphabetState: as,
Voter: v, Voter: v,

View file

@ -279,7 +279,7 @@ func newTestProc(t *testing.T, nonDefault func(p *Params)) (*Processor, error) {
eh := &testEventHandler{} eh := &testEventHandler{}
p := &Params{ p := &Params{
Log: test.NewLogger(t, true), Log: test.NewLogger(t),
PoolSize: 1, PoolSize: 1,
CleanupEnabled: false, CleanupEnabled: false,
CleanupThreshold: 3, CleanupThreshold: 3,

View file

@ -63,7 +63,7 @@ func TestBlobovnicza(t *testing.T) {
WithPath(p), WithPath(p),
WithObjectSizeLimit(objSizeLim), WithObjectSizeLimit(objSizeLim),
WithFullSizeLimit(sizeLim), WithFullSizeLimit(sizeLim),
WithLogger(test.NewLogger(t, true)), WithLogger(test.NewLogger(t)),
) )
defer os.Remove(p) defer os.Remove(p)

View file

@ -17,7 +17,7 @@ func TestBlobovniczaTree_Concurrency(t *testing.T) {
const n = 1000 const n = 1000
st := NewBlobovniczaTree( st := NewBlobovniczaTree(
WithLogger(test.NewLogger(t, true)), WithLogger(test.NewLogger(t)),
WithObjectSizeLimit(1024), WithObjectSizeLimit(1024),
WithBlobovniczaShallowWidth(10), WithBlobovniczaShallowWidth(10),
WithBlobovniczaShallowDepth(1), WithBlobovniczaShallowDepth(1),

View file

@ -17,7 +17,7 @@ import (
func TestExistsInvalidStorageID(t *testing.T) { func TestExistsInvalidStorageID(t *testing.T) {
dir := t.TempDir() dir := t.TempDir()
b := NewBlobovniczaTree( b := NewBlobovniczaTree(
WithLogger(test.NewLogger(t, true)), WithLogger(test.NewLogger(t)),
WithObjectSizeLimit(1024), WithObjectSizeLimit(1024),
WithBlobovniczaShallowWidth(2), WithBlobovniczaShallowWidth(2),
WithBlobovniczaShallowDepth(2), WithBlobovniczaShallowDepth(2),

View file

@ -13,7 +13,7 @@ func TestGeneric(t *testing.T) {
helper := func(t *testing.T, dir string) common.Storage { helper := func(t *testing.T, dir string) common.Storage {
return NewBlobovniczaTree( return NewBlobovniczaTree(
WithLogger(test.NewLogger(t, true)), WithLogger(test.NewLogger(t)),
WithObjectSizeLimit(maxObjectSize), WithObjectSizeLimit(maxObjectSize),
WithBlobovniczaShallowWidth(2), WithBlobovniczaShallowWidth(2),
WithBlobovniczaShallowDepth(2), WithBlobovniczaShallowDepth(2),
@ -40,7 +40,7 @@ func TestControl(t *testing.T) {
newTree := func(t *testing.T) common.Storage { newTree := func(t *testing.T) common.Storage {
return NewBlobovniczaTree( return NewBlobovniczaTree(
WithLogger(test.NewLogger(t, true)), WithLogger(test.NewLogger(t)),
WithObjectSizeLimit(maxObjectSize), WithObjectSizeLimit(maxObjectSize),
WithBlobovniczaShallowWidth(2), WithBlobovniczaShallowWidth(2),
WithBlobovniczaShallowDepth(2), WithBlobovniczaShallowDepth(2),

View file

@ -129,7 +129,7 @@ func testRebuildFailoverObjectDeletedFromSource(t *testing.T) {
func testRebuildFailoverValidate(t *testing.T, dir string, obj *objectSDK.Object, mustUpdateStorageID bool) { func testRebuildFailoverValidate(t *testing.T, dir string, obj *objectSDK.Object, mustUpdateStorageID bool) {
b := NewBlobovniczaTree( b := NewBlobovniczaTree(
WithLogger(test.NewLogger(t, true)), WithLogger(test.NewLogger(t)),
WithObjectSizeLimit(2048), WithObjectSizeLimit(2048),
WithBlobovniczaShallowWidth(2), WithBlobovniczaShallowWidth(2),
WithBlobovniczaShallowDepth(2), WithBlobovniczaShallowDepth(2),

View file

@ -41,7 +41,7 @@ func TestBlobovniczaTreeRebuild(t *testing.T) {
func testBlobovniczaTreeRebuildHelper(t *testing.T, sourceDepth, sourceWidth, targetDepth, targetWidth uint64, shouldMigrate bool) { func testBlobovniczaTreeRebuildHelper(t *testing.T, sourceDepth, sourceWidth, targetDepth, targetWidth uint64, shouldMigrate bool) {
dir := t.TempDir() dir := t.TempDir()
b := NewBlobovniczaTree( b := NewBlobovniczaTree(
WithLogger(test.NewLogger(t, true)), WithLogger(test.NewLogger(t)),
WithObjectSizeLimit(2048), WithObjectSizeLimit(2048),
WithBlobovniczaShallowWidth(sourceWidth), WithBlobovniczaShallowWidth(sourceWidth),
WithBlobovniczaShallowDepth(sourceDepth), WithBlobovniczaShallowDepth(sourceDepth),
@ -81,7 +81,7 @@ func testBlobovniczaTreeRebuildHelper(t *testing.T, sourceDepth, sourceWidth, ta
require.NoError(t, b.Close()) require.NoError(t, b.Close())
b = NewBlobovniczaTree( b = NewBlobovniczaTree(
WithLogger(test.NewLogger(t, true)), WithLogger(test.NewLogger(t)),
WithObjectSizeLimit(2048), WithObjectSizeLimit(2048),
WithBlobovniczaShallowWidth(targetWidth), WithBlobovniczaShallowWidth(targetWidth),
WithBlobovniczaShallowDepth(targetDepth), WithBlobovniczaShallowDepth(targetDepth),

View file

@ -15,7 +15,7 @@ import (
func TestSimpleLifecycle(t *testing.T) { func TestSimpleLifecycle(t *testing.T) {
s := New( s := New(
WithRootPath("memstore"), WithRootPath("memstore"),
WithLogger(test.NewLogger(t, true)), WithLogger(test.NewLogger(t)),
) )
t.Cleanup(func() { _ = s.Close() }) t.Cleanup(func() { _ = s.Close() })
require.NoError(t, s.Open(false)) require.NoError(t, s.Open(false))

View file

@ -49,7 +49,7 @@ func TestInitializationFailure(t *testing.T) {
return []shard.Option{ return []shard.Option{
shard.WithID(sid), shard.WithID(sid),
shard.WithLogger(test.NewLogger(t, true)), shard.WithLogger(test.NewLogger(t)),
shard.WithBlobStorOptions( shard.WithBlobStorOptions(
blobstor.WithStorages(storages)), blobstor.WithStorages(storages)),
shard.WithMetaBaseOptions( shard.WithMetaBaseOptions(
@ -289,7 +289,7 @@ func engineWithShards(t *testing.T, path string, num int) (*StorageEngine, []str
te := testNewEngine(t). te := testNewEngine(t).
setShardsNumOpts(t, num, func(id int) []shard.Option { setShardsNumOpts(t, num, func(id int) []shard.Option {
return []shard.Option{ return []shard.Option{
shard.WithLogger(test.NewLogger(t, true)), shard.WithLogger(test.NewLogger(t)),
shard.WithBlobStorOptions( shard.WithBlobStorOptions(
blobstor.WithStorages(newStorages(filepath.Join(addPath, strconv.Itoa(id)), errSmallSize))), blobstor.WithStorages(newStorages(filepath.Join(addPath, strconv.Itoa(id)), errSmallSize))),
shard.WithMetaBaseOptions( shard.WithMetaBaseOptions(

View file

@ -53,7 +53,7 @@ func TestDeleteBigObject(t *testing.T) {
s3 := testNewShard(t, 3) s3 := testNewShard(t, 3)
e := testNewEngine(t).setInitializedShards(t, s1, s2, s3).engine e := testNewEngine(t).setInitializedShards(t, s1, s2, s3).engine
e.log = test.NewLogger(t, true) e.log = test.NewLogger(t)
defer e.Close(context.Background()) defer e.Close(context.Background())
for i := range children { for i := range children {

View file

@ -79,7 +79,7 @@ type testEngineWrapper struct {
} }
func testNewEngine(t testing.TB, opts ...Option) *testEngineWrapper { func testNewEngine(t testing.TB, opts ...Option) *testEngineWrapper {
engine := New(WithLogger(test.NewLogger(t, true))) engine := New(WithLogger(test.NewLogger(t)))
for _, opt := range opts { for _, opt := range opts {
opt(engine.cfg) opt(engine.cfg)
} }
@ -198,7 +198,7 @@ func testNewShard(t testing.TB, id int) *shard.Shard {
func testDefaultShardOptions(t testing.TB, id int) []shard.Option { func testDefaultShardOptions(t testing.TB, id int) []shard.Option {
return []shard.Option{ return []shard.Option{
shard.WithLogger(test.NewLogger(t, true)), shard.WithLogger(test.NewLogger(t)),
shard.WithBlobStorOptions( shard.WithBlobStorOptions(
blobstor.WithStorages( blobstor.WithStorages(
newStorages(t.TempDir(), 1<<20))), newStorages(t.TempDir(), 1<<20))),

View file

@ -55,7 +55,7 @@ func newEngineWithErrorThreshold(t testing.TB, dir string, errThreshold uint32)
largeFileStorage: largeFileStorage, largeFileStorage: largeFileStorage,
} }
return []shard.Option{ return []shard.Option{
shard.WithLogger(test.NewLogger(t, true)), shard.WithLogger(test.NewLogger(t)),
shard.WithBlobStorOptions(blobstor.WithStorages(storages)), shard.WithBlobStorOptions(blobstor.WithStorages(storages)),
shard.WithMetaBaseOptions( shard.WithMetaBaseOptions(
meta.WithPath(filepath.Join(dir, fmt.Sprintf("%d.metabase", id))), meta.WithPath(filepath.Join(dir, fmt.Sprintf("%d.metabase", id))),

View file

@ -30,7 +30,7 @@ func newEngineEvacuate(t *testing.T, shardNum int, objPerShard int) (*StorageEng
te := testNewEngine(t). te := testNewEngine(t).
setShardsNumOpts(t, shardNum, func(id int) []shard.Option { setShardsNumOpts(t, shardNum, func(id int) []shard.Option {
return []shard.Option{ return []shard.Option{
shard.WithLogger(test.NewLogger(t, true)), shard.WithLogger(test.NewLogger(t)),
shard.WithBlobStorOptions( shard.WithBlobStorOptions(
blobstor.WithStorages([]blobstor.SubStorage{{ blobstor.WithStorages([]blobstor.SubStorage{{
Storage: fstree.New( Storage: fstree.New(

View file

@ -65,7 +65,7 @@ func TestListWithCursor(t *testing.T) {
t.Parallel() t.Parallel()
e := testNewEngine(t).setShardsNumOpts(t, tt.shardNum, func(id int) []shard.Option { e := testNewEngine(t).setShardsNumOpts(t, tt.shardNum, func(id int) []shard.Option {
return []shard.Option{ return []shard.Option{
shard.WithLogger(test.NewLogger(t, true)), shard.WithLogger(test.NewLogger(t)),
shard.WithBlobStorOptions( shard.WithBlobStorOptions(
blobstor.WithStorages( blobstor.WithStorages(
newStorages(t.TempDir(), 1<<20))), newStorages(t.TempDir(), 1<<20))),

View file

@ -64,7 +64,7 @@ func TestShardOpen(t *testing.T) {
newShard := func() *Shard { newShard := func() *Shard {
return New( return New(
WithID(NewIDFromBytes([]byte{})), WithID(NewIDFromBytes([]byte{})),
WithLogger(test.NewLogger(t, true)), WithLogger(test.NewLogger(t)),
WithBlobStorOptions( WithBlobStorOptions(
blobstor.WithStorages([]blobstor.SubStorage{ blobstor.WithStorages([]blobstor.SubStorage{
{Storage: st}, {Storage: st},

View file

@ -30,13 +30,13 @@ func Test_ObjectNotFoundIfNotDeletedFromMetabase(t *testing.T) {
rootPath := t.TempDir() rootPath := t.TempDir()
var sh *Shard var sh *Shard
l := test.NewLogger(t, true) l := test.NewLogger(t)
blobOpts := []blobstor.Option{ blobOpts := []blobstor.Option{
blobstor.WithLogger(test.NewLogger(t, true)), blobstor.WithLogger(test.NewLogger(t)),
blobstor.WithStorages([]blobstor.SubStorage{ blobstor.WithStorages([]blobstor.SubStorage{
{ {
Storage: blobovniczatree.NewBlobovniczaTree( Storage: blobovniczatree.NewBlobovniczaTree(
blobovniczatree.WithLogger(test.NewLogger(t, true)), blobovniczatree.WithLogger(test.NewLogger(t)),
blobovniczatree.WithRootPath(filepath.Join(rootPath, "blob", "blobovnicza")), blobovniczatree.WithRootPath(filepath.Join(rootPath, "blob", "blobovnicza")),
blobovniczatree.WithBlobovniczaShallowDepth(1), blobovniczatree.WithBlobovniczaShallowDepth(1),
blobovniczatree.WithBlobovniczaShallowWidth(1)), blobovniczatree.WithBlobovniczaShallowWidth(1)),

View file

@ -78,7 +78,7 @@ func testShardGetRange(t *testing.T, hasWriteCache bool) {
blobstor.WithStorages([]blobstor.SubStorage{ blobstor.WithStorages([]blobstor.SubStorage{
{ {
Storage: blobovniczatree.NewBlobovniczaTree( Storage: blobovniczatree.NewBlobovniczaTree(
blobovniczatree.WithLogger(test.NewLogger(t, true)), blobovniczatree.WithLogger(test.NewLogger(t)),
blobovniczatree.WithRootPath(filepath.Join(t.TempDir(), "blob", "blobovnicza")), blobovniczatree.WithRootPath(filepath.Join(t.TempDir(), "blob", "blobovnicza")),
blobovniczatree.WithBlobovniczaShallowDepth(1), blobovniczatree.WithBlobovniczaShallowDepth(1),
blobovniczatree.WithBlobovniczaShallowWidth(1)), blobovniczatree.WithBlobovniczaShallowWidth(1)),

View file

@ -27,7 +27,7 @@ func TestShardReload(t *testing.T) {
p := t.Name() p := t.Name()
defer os.RemoveAll(p) defer os.RemoveAll(p)
l := test.NewLogger(t, true) l := test.NewLogger(t)
blobOpts := []blobstor.Option{ blobOpts := []blobstor.Option{
blobstor.WithLogger(l), blobstor.WithLogger(l),
blobstor.WithStorages([]blobstor.SubStorage{ blobstor.WithStorages([]blobstor.SubStorage{

View file

@ -56,11 +56,11 @@ func newCustomShard(t testing.TB, enableWriteCache bool, o shardOptions) *Shard
if o.bsOpts == nil { if o.bsOpts == nil {
o.bsOpts = []blobstor.Option{ o.bsOpts = []blobstor.Option{
blobstor.WithLogger(test.NewLogger(t, true)), blobstor.WithLogger(test.NewLogger(t)),
blobstor.WithStorages([]blobstor.SubStorage{ blobstor.WithStorages([]blobstor.SubStorage{
{ {
Storage: blobovniczatree.NewBlobovniczaTree( Storage: blobovniczatree.NewBlobovniczaTree(
blobovniczatree.WithLogger(test.NewLogger(t, true)), blobovniczatree.WithLogger(test.NewLogger(t)),
blobovniczatree.WithRootPath(filepath.Join(o.rootPath, "blob", "blobovnicza")), blobovniczatree.WithRootPath(filepath.Join(o.rootPath, "blob", "blobovnicza")),
blobovniczatree.WithBlobovniczaShallowDepth(1), blobovniczatree.WithBlobovniczaShallowDepth(1),
blobovniczatree.WithBlobovniczaShallowWidth(1)), blobovniczatree.WithBlobovniczaShallowWidth(1)),
@ -78,7 +78,7 @@ func newCustomShard(t testing.TB, enableWriteCache bool, o shardOptions) *Shard
opts := []Option{ opts := []Option{
WithID(NewIDFromBytes([]byte{})), WithID(NewIDFromBytes([]byte{})),
WithLogger(test.NewLogger(t, true)), WithLogger(test.NewLogger(t)),
WithBlobStorOptions(o.bsOpts...), WithBlobStorOptions(o.bsOpts...),
WithMetaBaseOptions( WithMetaBaseOptions(
append([]meta.Option{ append([]meta.Option{

View file

@ -24,7 +24,7 @@ import (
) )
func TestFlush(t *testing.T) { func TestFlush(t *testing.T) {
testlogger := test.NewLogger(t, true) testlogger := test.NewLogger(t)
createCacheFn := func(t *testing.T, smallSize uint64, mb *meta.DB, bs MainStorage, opts ...Option) Cache { createCacheFn := func(t *testing.T, smallSize uint64, mb *meta.DB, bs MainStorage, opts ...Option) Cache {
return New( return New(

View file

@ -10,7 +10,7 @@ import (
func TestGeneric(t *testing.T) { func TestGeneric(t *testing.T) {
storagetest.TestAll(t, func(t *testing.T) storagetest.Component { storagetest.TestAll(t, func(t *testing.T) storagetest.Component {
return New( return New(
WithLogger(test.NewLogger(t, true)), WithLogger(test.NewLogger(t)),
WithFlushWorkersCount(2), WithFlushWorkersCount(2),
WithPath(t.TempDir())) WithPath(t.TempDir()))
}) })

View file

@ -20,7 +20,7 @@ func TestEventHandling(t *testing.T) {
notaryRequestsCh := make(chan *result.NotaryRequestEvent) notaryRequestsCh := make(chan *result.NotaryRequestEvent)
l, err := NewListener(ListenerParams{ l, err := NewListener(ListenerParams{
Logger: test.NewLogger(t, true), Logger: test.NewLogger(t),
Subscriber: &testSubscriber{ Subscriber: &testSubscriber{
blockCh: blockCh, blockCh: blockCh,
notificationCh: notificationCh, notificationCh: notificationCh,
@ -102,7 +102,7 @@ func TestErrorPassing(t *testing.T) {
t.Run("notification error", func(t *testing.T) { t.Run("notification error", func(t *testing.T) {
nErr := fmt.Errorf("notification error") nErr := fmt.Errorf("notification error")
l, err := NewListener(ListenerParams{ l, err := NewListener(ListenerParams{
Logger: test.NewLogger(t, true), Logger: test.NewLogger(t),
Subscriber: &testSubscriber{ Subscriber: &testSubscriber{
blockCh: blockCh, blockCh: blockCh,
notificationCh: notificationCh, notificationCh: notificationCh,
@ -126,7 +126,7 @@ func TestErrorPassing(t *testing.T) {
t.Run("block error", func(t *testing.T) { t.Run("block error", func(t *testing.T) {
bErr := fmt.Errorf("notification error") bErr := fmt.Errorf("notification error")
l, err := NewListener(ListenerParams{ l, err := NewListener(ListenerParams{
Logger: test.NewLogger(t, true), Logger: test.NewLogger(t),
Subscriber: &testSubscriber{ Subscriber: &testSubscriber{
blockCh: blockCh, blockCh: blockCh,
notificationCh: notificationCh, notificationCh: notificationCh,

View file

@ -270,7 +270,7 @@ func TestGetLocalOnly(t *testing.T) {
newSvc := func(storage *testStorage) *Service { newSvc := func(storage *testStorage) *Service {
return &Service{ return &Service{
log: test.NewLogger(t, true), log: test.NewLogger(t),
localStorage: storage, localStorage: storage,
} }
} }
@ -532,7 +532,7 @@ func TestGetRemoteSmall(t *testing.T) {
const curEpoch = 13 const curEpoch = 13
return &Service{ return &Service{
log: test.NewLogger(t, true), log: test.NewLogger(t),
localStorage: newTestStorage(), localStorage: newTestStorage(),
traverserGenerator: &testTraverserGenerator{ traverserGenerator: &testTraverserGenerator{
c: cnr, c: cnr,
@ -1663,7 +1663,7 @@ func TestGetFromPastEpoch(t *testing.T) {
const curEpoch = 13 const curEpoch = 13
svc := &Service{ svc := &Service{
log: test.NewLogger(t, true), log: test.NewLogger(t),
localStorage: newTestStorage(), localStorage: newTestStorage(),
epochSource: testEpochReceiver(curEpoch), epochSource: testEpochReceiver(curEpoch),
traverserGenerator: &testTraverserGenerator{ traverserGenerator: &testTraverserGenerator{

View file

@ -161,7 +161,7 @@ func TestGetLocalOnly(t *testing.T) {
newSvc := func(storage *testStorage) *Service { newSvc := func(storage *testStorage) *Service {
svc := &Service{cfg: new(cfg)} svc := &Service{cfg: new(cfg)}
svc.log = test.NewLogger(t, true) svc.log = test.NewLogger(t)
svc.localStorage = storage svc.localStorage = storage
return svc return svc
@ -277,7 +277,7 @@ func TestGetRemoteSmall(t *testing.T) {
newSvc := func(b *testPlacementBuilder, c *testClientCache) *Service { newSvc := func(b *testPlacementBuilder, c *testClientCache) *Service {
svc := &Service{cfg: new(cfg)} svc := &Service{cfg: new(cfg)}
svc.log = test.NewLogger(t, true) svc.log = test.NewLogger(t)
svc.localStorage = newTestStorage() svc.localStorage = newTestStorage()
const curEpoch = 13 const curEpoch = 13
@ -430,7 +430,7 @@ func TestGetFromPastEpoch(t *testing.T) {
c22.addResult(idCnr, ids22, nil) c22.addResult(idCnr, ids22, nil)
svc := &Service{cfg: new(cfg)} svc := &Service{cfg: new(cfg)}
svc.log = test.NewLogger(t, true) svc.log = test.NewLogger(t)
svc.localStorage = newTestStorage() svc.localStorage = newTestStorage()
const curEpoch = 13 const curEpoch = 13
@ -543,7 +543,7 @@ func TestGetWithSessionToken(t *testing.T) {
w := new(simpleIDWriter) w := new(simpleIDWriter)
svc := &Service{cfg: new(cfg)} svc := &Service{cfg: new(cfg)}
svc.log = test.NewLogger(t, true) svc.log = test.NewLogger(t)
svc.localStorage = localStorage svc.localStorage = localStorage
const curEpoch = 13 const curEpoch = 13

View file

@ -100,7 +100,7 @@ func TestMessageSign(t *testing.T) {
s := &Service{ s := &Service{
cfg: cfg{ cfg: cfg{
log: test.NewLogger(t, true), log: test.NewLogger(t),
key: &privs[0].PrivateKey, key: &privs[0].PrivateKey,
nmSource: dummyNetmapSource{}, nmSource: dummyNetmapSource{},
cnrSource: dummyContainerSource{ cnrSource: dummyContainerSource{

View file

@ -10,20 +10,15 @@ import (
) )
// NewLogger creates a new logger. // NewLogger creates a new logger.
// func NewLogger(t testing.TB) *logger.Logger {
// If debug, development logger is created.
func NewLogger(t testing.TB, debug bool) *logger.Logger {
var l logger.Logger
l.Logger = zap.L()
if debug {
cfg := zap.NewDevelopmentConfig() cfg := zap.NewDevelopmentConfig()
cfg.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder cfg.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
log, err := cfg.Build() log, err := cfg.Build()
require.NoError(t, err, "could not prepare logger") require.NoError(t, err, "could not prepare logger")
var l logger.Logger
l.Logger = log l.Logger = log
}
return &l return &l
} }