[#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),
WithObjectSizeLimit(objSizeLim),
WithFullSizeLimit(sizeLim),
WithLogger(test.NewLogger(t, false)),
WithLogger(test.NewLogger(t, true)),
)
defer os.Remove(p)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -79,7 +79,7 @@ type testEngineWrapper struct {
}
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 {
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 {
return []shard.Option{
shard.WithLogger(test.NewLogger(t, false)),
shard.WithLogger(test.NewLogger(t, true)),
shard.WithBlobStorOptions(
blobstor.WithStorages(
newStorages(t.TempDir(), 1<<20))),

View file

@ -55,7 +55,7 @@ func newEngineWithErrorThreshold(t testing.TB, dir string, errThreshold uint32)
largeFileStorage: largeFileStorage,
}
return []shard.Option{
shard.WithLogger(test.NewLogger(t, false)),
shard.WithLogger(test.NewLogger(t, true)),
shard.WithBlobStorOptions(blobstor.WithStorages(storages)),
shard.WithMetaBaseOptions(
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).
setShardsNumOpts(t, shardNum, func(id int) []shard.Option {
return []shard.Option{
shard.WithLogger(test.NewLogger(t, false)),
shard.WithLogger(test.NewLogger(t, true)),
shard.WithBlobStorOptions(
blobstor.WithStorages([]blobstor.SubStorage{{
Storage: fstree.New(

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -58,11 +58,11 @@ func newCustomShard(t testing.TB, rootPath string, enableWriteCache bool, wcOpts
if bsOpts == nil {
bsOpts = []blobstor.Option{
blobstor.WithLogger(test.NewLogger(t, false)),
blobstor.WithLogger(test.NewLogger(t, true)),
blobstor.WithStorages([]blobstor.SubStorage{
{
Storage: blobovniczatree.NewBlobovniczaTree(
blobovniczatree.WithLogger(test.NewLogger(t, false)),
blobovniczatree.WithLogger(test.NewLogger(t, true)),
blobovniczatree.WithRootPath(filepath.Join(rootPath, "blob", "blobovnicza")),
blobovniczatree.WithBlobovniczaShallowDepth(1),
blobovniczatree.WithBlobovniczaShallowWidth(1)),
@ -80,7 +80,7 @@ func newCustomShard(t testing.TB, rootPath string, enableWriteCache bool, wcOpts
opts := []shard.Option{
shard.WithID(shard.NewIDFromBytes([]byte{})),
shard.WithLogger(test.NewLogger(t, false)),
shard.WithLogger(test.NewLogger(t, true)),
shard.WithBlobStorOptions(bsOpts...),
shard.WithMetaBaseOptions(
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 {
return New(
append([]Option{
WithLogger(test.NewLogger(t, false)),
WithLogger(test.NewLogger(t, true)),
WithPath(filepath.Join(t.TempDir(), "writecache")),
WithMetabase(mb),
WithBlobstor(bs),

View file

@ -11,7 +11,7 @@ import (
func TestGeneric(t *testing.T) {
storagetest.TestAll(t, func(t *testing.T) storagetest.Component {
return New(
WithLogger(test.NewLogger(t, false)),
WithLogger(test.NewLogger(t, true)),
WithFlushWorkersCount(2),
WithPath(t.TempDir()),
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 {
return New(
append([]Option{
WithLogger(test.NewLogger(t, false)),
WithLogger(test.NewLogger(t, true)),
WithPath(filepath.Join(t.TempDir(), "writecache")),
WithSmallObjectSize(smallSize),
WithMetabase(mb),

View file

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

View file

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

View file

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

View file

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