[#638] Unify test loggers

In some places we have debug=false, in others debug=true.
Let's be consistent.

Semantic patch:
```
@@
@@
-test.NewLogger(..., false)
+test.NewLogger(..., true)
```

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-08-23 10:55:36 +03:00 committed by Evgenii Stratonikov
parent 322c1dc273
commit 96e690883f
22 changed files with 34 additions and 34 deletions

View file

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

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, false)), WithLogger(test.NewLogger(t, true)),
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, false)), WithLogger(test.NewLogger(t, true)),
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, false)), WithLogger(test.NewLogger(t, true)),
WithObjectSizeLimit(maxObjectSize), WithObjectSizeLimit(maxObjectSize),
WithBlobovniczaShallowWidth(2), WithBlobovniczaShallowWidth(2),
WithBlobovniczaShallowDepth(2), WithBlobovniczaShallowDepth(2),

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, false)), WithLogger(test.NewLogger(t, true)),
) )
t.Cleanup(func() { _ = s.Close() }) t.Cleanup(func() { _ = s.Close() })
require.NoError(t, s.Open(false)) require.NoError(t, s.Open(false))

View file

@ -53,7 +53,7 @@ func TestInitializationFailure(t *testing.T) {
return []shard.Option{ return []shard.Option{
shard.WithID(sid), shard.WithID(sid),
shard.WithLogger(test.NewLogger(t, false)), shard.WithLogger(test.NewLogger(t, true)),
shard.WithBlobStorOptions( shard.WithBlobStorOptions(
blobstor.WithStorages(storages)), blobstor.WithStorages(storages)),
shard.WithMetaBaseOptions( shard.WithMetaBaseOptions(
@ -294,7 +294,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, false)), shard.WithLogger(test.NewLogger(t, true)),
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, false) e.log = test.NewLogger(t, true)
defer e.Close() defer e.Close()
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, false))) engine := New(WithLogger(test.NewLogger(t, true)))
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, false)), shard.WithLogger(test.NewLogger(t, true)),
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, false)), shard.WithLogger(test.NewLogger(t, true)),
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, false)), shard.WithLogger(test.NewLogger(t, true)),
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, false)), shard.WithLogger(test.NewLogger(t, true)),
shard.WithBlobStorOptions( shard.WithBlobStorOptions(
blobstor.WithStorages( blobstor.WithStorages(
newStorages(t.TempDir(), 1<<20))), newStorages(t.TempDir(), 1<<20))),

View file

@ -74,7 +74,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, false)), WithLogger(test.NewLogger(t, true)),
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, false) l := test.NewLogger(t, true)
blobOpts := []blobstor.Option{ blobOpts := []blobstor.Option{
blobstor.WithLogger(test.NewLogger(t, false)), blobstor.WithLogger(test.NewLogger(t, true)),
blobstor.WithStorages([]blobstor.SubStorage{ blobstor.WithStorages([]blobstor.SubStorage{
{ {
Storage: blobovniczatree.NewBlobovniczaTree( Storage: blobovniczatree.NewBlobovniczaTree(
blobovniczatree.WithLogger(test.NewLogger(t, false)), blobovniczatree.WithLogger(test.NewLogger(t, true)),
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

@ -81,7 +81,7 @@ func testShardGetRange(t *testing.T, hasWriteCache bool) {
[]blobstor.Option{blobstor.WithStorages([]blobstor.SubStorage{ []blobstor.Option{blobstor.WithStorages([]blobstor.SubStorage{
{ {
Storage: blobovniczatree.NewBlobovniczaTree( Storage: blobovniczatree.NewBlobovniczaTree(
blobovniczatree.WithLogger(test.NewLogger(t, false)), blobovniczatree.WithLogger(test.NewLogger(t, true)),
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, false) l := test.NewLogger(t, true)
blobOpts := []blobstor.Option{ blobOpts := []blobstor.Option{
blobstor.WithLogger(l), blobstor.WithLogger(l),
blobstor.WithStorages([]blobstor.SubStorage{ blobstor.WithStorages([]blobstor.SubStorage{

View file

@ -58,11 +58,11 @@ func newCustomShard(t testing.TB, rootPath string, enableWriteCache bool, wcOpts
if bsOpts == nil { if bsOpts == nil {
bsOpts = []blobstor.Option{ bsOpts = []blobstor.Option{
blobstor.WithLogger(test.NewLogger(t, false)), blobstor.WithLogger(test.NewLogger(t, true)),
blobstor.WithStorages([]blobstor.SubStorage{ blobstor.WithStorages([]blobstor.SubStorage{
{ {
Storage: blobovniczatree.NewBlobovniczaTree( Storage: blobovniczatree.NewBlobovniczaTree(
blobovniczatree.WithLogger(test.NewLogger(t, false)), blobovniczatree.WithLogger(test.NewLogger(t, true)),
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)),
@ -80,7 +80,7 @@ func newCustomShard(t testing.TB, rootPath string, enableWriteCache bool, wcOpts
opts := []shard.Option{ opts := []shard.Option{
shard.WithID(shard.NewIDFromBytes([]byte{})), shard.WithID(shard.NewIDFromBytes([]byte{})),
shard.WithLogger(test.NewLogger(t, false)), shard.WithLogger(test.NewLogger(t, true)),
shard.WithBlobStorOptions(bsOpts...), shard.WithBlobStorOptions(bsOpts...),
shard.WithMetaBaseOptions( shard.WithMetaBaseOptions(
append([]meta.Option{ append([]meta.Option{

View file

@ -20,7 +20,7 @@ func TestFlush(t *testing.T) {
createCacheFn := func(t *testing.T, smallSize uint64, mb *meta.DB, bs writecache.MainStorage, opts ...Option) writecache.Cache { createCacheFn := func(t *testing.T, smallSize uint64, mb *meta.DB, bs writecache.MainStorage, opts ...Option) writecache.Cache {
return New( return New(
append([]Option{ append([]Option{
WithLogger(test.NewLogger(t, false)), WithLogger(test.NewLogger(t, true)),
WithPath(filepath.Join(t.TempDir(), "writecache")), WithPath(filepath.Join(t.TempDir(), "writecache")),
WithMetabase(mb), WithMetabase(mb),
WithBlobstor(bs), WithBlobstor(bs),

View file

@ -11,7 +11,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, false)), WithLogger(test.NewLogger(t, true)),
WithFlushWorkersCount(2), WithFlushWorkersCount(2),
WithPath(t.TempDir()), WithPath(t.TempDir()),
WithGCInterval(1*time.Second)) WithGCInterval(1*time.Second))

View file

@ -23,7 +23,7 @@ func TestFlush(t *testing.T) {
createCacheFn := func(t *testing.T, smallSize uint64, mb *meta.DB, bs writecache.MainStorage, opts ...Option) writecache.Cache { createCacheFn := func(t *testing.T, smallSize uint64, mb *meta.DB, bs writecache.MainStorage, opts ...Option) writecache.Cache {
return New( return New(
append([]Option{ append([]Option{
WithLogger(test.NewLogger(t, false)), WithLogger(test.NewLogger(t, true)),
WithPath(filepath.Join(t.TempDir(), "writecache")), WithPath(filepath.Join(t.TempDir(), "writecache")),
WithSmallObjectSize(smallSize), WithSmallObjectSize(smallSize),
WithMetabase(mb), WithMetabase(mb),

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, false)), WithLogger(test.NewLogger(t, true)),
WithFlushWorkersCount(2), WithFlushWorkersCount(2),
WithPath(t.TempDir())) WithPath(t.TempDir()))
}) })

View file

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

View file

@ -152,7 +152,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, false) svc.log = test.NewLogger(t, true)
svc.localStorage = storage svc.localStorage = storage
return svc return svc
@ -254,7 +254,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, false) svc.log = test.NewLogger(t, true)
svc.localStorage = newTestStorage() svc.localStorage = newTestStorage()
const curEpoch = 13 const curEpoch = 13
@ -363,7 +363,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, false) svc.log = test.NewLogger(t, true)
svc.localStorage = newTestStorage() svc.localStorage = newTestStorage()
const curEpoch = 13 const curEpoch = 13
@ -476,7 +476,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, false) svc.log = test.NewLogger(t, true)
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, false), log: test.NewLogger(t, true),
key: &privs[0].PrivateKey, key: &privs[0].PrivateKey,
nmSource: dummyNetmapSource{}, nmSource: dummyNetmapSource{},
cnrSource: dummyContainerSource{ cnrSource: dummyContainerSource{