From a6fb37a9da224827fe0ed74313e043a68306650b Mon Sep 17 00:00:00 2001 From: Alena Khineika Date: Mon, 1 Jul 2024 16:34:16 +0200 Subject: [PATCH 01/11] fix: sh.status() should show full list of tag ranges in verbose mode only MONGOSH-1327 --- packages/shell-api/src/helpers.ts | 28 +++++++++++++++------- packages/shell-api/src/shard.spec.ts | 36 ++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 8 deletions(-) diff --git a/packages/shell-api/src/helpers.ts b/packages/shell-api/src/helpers.ts index be5f74736..d3fb7645d 100644 --- a/packages/shell-api/src/helpers.ts +++ b/packages/shell-api/src/helpers.ts @@ -614,18 +614,30 @@ export async function getPrintableShardStatus( ); } - const tagsRes: any[] = []; - for await (const tag of ( + const tags = await ( await configDB.getCollection('tags').find({ ns: coll._id, }) - ).sort({ min: 1 })) { - tagsRes.push({ - tag: tag.tag, - min: tag.min, - max: tag.max, - }); + ) + .sort({ min: 1 }) + .toArray(); + const tagsRes: any[] = []; + + // NOTE: this will return tags as a string, and will print ugly BSON + if (tags.length < 20 || verbose) { + for (const tag of tags) { + tagsRes.push({ + tag: tag.tag, + min: tag.min, + max: tag.max, + }); + } + } else { + tagsRes.push( + 'too many tags to print, use verbose if you want to force print' + ); } + collRes.chunks = chunksRes; collRes.tags = tagsRes; return [coll._id, collRes] as const; diff --git a/packages/shell-api/src/shard.spec.ts b/packages/shell-api/src/shard.spec.ts index 498a2a0ac..b2d8af772 100644 --- a/packages/shell-api/src/shard.spec.ts +++ b/packages/shell-api/src/shard.spec.ts @@ -2032,6 +2032,42 @@ describe('Shard', function () { ); expect((await sh.status()).value.shards[0].tags).to.deep.equal([]); }); + it('shows a full array if tags less than 20', async function () { + const db = instanceState.currentDb.getSiblingDB(dbName); + await db.getCollection('coll').createIndex({ key: 1 }); + for (let i = 0; i < 19; i++) { + await db.getCollection('coll').insertOne({ key: 'A', value: i * 10 }); + await sh.addShardToZone(`${shardId}-0`, `zone${i}`); + await sh.updateZoneKeyRange( + ns, + { key: i * 10 - 10 }, + { key: i * 10 }, + `zone${i}` + ); + await sh.addShardTag(`${shardId}-0`, `zone${i}`); + } + + const tags = (await sh.status()).value.databases.find( + (d) => d.database._id === 'test' + ).collections[ns].tags; + expect(tags.length).to.equal(19); + }); + it('shows tags as a string when there are too many', async function () { + await sh.addShardToZone(`${shardId}-0`, 'zone19'); + await sh.updateZoneKeyRange(ns, { key: 180 }, { key: 190 }, 'zone19'); + await sh.addShardTag(`${shardId}-0`, 'zone19'); + + const databases = (await sh.status()).value.databases; + const collections = databases.find( + (d) => d.database._id === 'test' + ).collections; + const tags = collections[ns].tags; + + expect(tags.length).to.equal(1); + expect(tags[0]).to.equal( + 'too many tags to print, use verbose if you want to force print' + ); + }); }); describe('balancer', function () { it('reports balancer state', async function () { From 8283cd1b918b29a5f646865bfa6ae0ba774664c0 Mon Sep 17 00:00:00 2001 From: Alena Khineika Date: Wed, 3 Jul 2024 16:16:47 +0200 Subject: [PATCH 02/11] test: start from zero --- packages/shell-api/src/shard.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/shell-api/src/shard.spec.ts b/packages/shell-api/src/shard.spec.ts index b2d8af772..87702db92 100644 --- a/packages/shell-api/src/shard.spec.ts +++ b/packages/shell-api/src/shard.spec.ts @@ -2040,8 +2040,8 @@ describe('Shard', function () { await sh.addShardToZone(`${shardId}-0`, `zone${i}`); await sh.updateZoneKeyRange( ns, - { key: i * 10 - 10 }, { key: i * 10 }, + { key: i * 10 + 10 }, `zone${i}` ); await sh.addShardTag(`${shardId}-0`, `zone${i}`); @@ -2054,7 +2054,7 @@ describe('Shard', function () { }); it('shows tags as a string when there are too many', async function () { await sh.addShardToZone(`${shardId}-0`, 'zone19'); - await sh.updateZoneKeyRange(ns, { key: 180 }, { key: 190 }, 'zone19'); + await sh.updateZoneKeyRange(ns, { key: 190 }, { key: 200 }, 'zone19'); await sh.addShardTag(`${shardId}-0`, 'zone19'); const databases = (await sh.status()).value.databases; From 0a2cc2fbfbf38c428120db1c5d33a4e2678ee57d Mon Sep 17 00:00:00 2001 From: Alena Khineika Date: Tue, 16 Jul 2024 15:58:26 +0200 Subject: [PATCH 03/11] feat: print 20 tags and chunks and then a string message --- packages/shell-api/src/helpers.ts | 45 +++++++++++++--------------- packages/shell-api/src/shard.spec.ts | 43 +++++++++++++++++++++----- 2 files changed, 56 insertions(+), 32 deletions(-) diff --git a/packages/shell-api/src/helpers.ts b/packages/shell-api/src/helpers.ts index d3fb7645d..ff5d9523d 100644 --- a/packages/shell-api/src/helpers.ts +++ b/packages/shell-api/src/helpers.ts @@ -556,6 +556,7 @@ export async function getPrintableShardStatus( { noBalance: coll.noBalance }, ]; } + const chunksRes = []; const chunksCollMatch = buildConfigChunksCollectionMatch(coll); const chunks = await ( @@ -566,21 +567,20 @@ export async function getPrintableShardStatus( { $sort: { shard: 1 } }, ]) ).toArray(); - let totalChunks = 0; + collRes.chunkMetadata = []; + chunks.forEach((z: any) => { - totalChunks += z.nChunks; collRes.chunkMetadata.push({ shard: z.shard, nChunks: z.nChunks, }); }); - // NOTE: this will return the chunk info as a string, and will print ugly BSON - if (totalChunks < 20 || verbose) { - for await (const chunk of ( - await chunksColl.find(chunksCollMatch) - ).sort({ min: 1 })) { + for await (const chunk of ( + await chunksColl.find(chunksCollMatch) + ).sort({ min: 1 })) { + if (chunksRes.length < 20 || verbose) { const c = { min: chunk.min, max: chunk.max, @@ -607,37 +607,32 @@ export async function getPrintableShardStatus( ); if (chunk.jumbo) c.jumbo = 'yes'; chunksRes.push(c); + } else if (chunksRes.length === 20 && !verbose) { + chunksRes.push( + 'too many chunks to print, use verbose if you want to force print' + ); } - } else { - chunksRes.push( - 'too many chunks to print, use verbose if you want to force print' - ); } - const tags = await ( + const tagsRes: any[] = []; + for await (const tag of ( await configDB.getCollection('tags').find({ ns: coll._id, }) - ) - .sort({ min: 1 }) - .toArray(); - const tagsRes: any[] = []; - - // NOTE: this will return tags as a string, and will print ugly BSON - if (tags.length < 20 || verbose) { - for (const tag of tags) { + ).sort({ min: 1 })) { + if (tagsRes.length < 20 || verbose) { tagsRes.push({ tag: tag.tag, min: tag.min, max: tag.max, }); } - } else { - tagsRes.push( - 'too many tags to print, use verbose if you want to force print' - ); + if (tagsRes.length === 20 && !verbose) { + tagsRes.push( + 'too many tags to print, use verbose if you want to force print' + ); + } } - collRes.chunks = chunksRes; collRes.tags = tagsRes; return [coll._id, collRes] as const; diff --git a/packages/shell-api/src/shard.spec.ts b/packages/shell-api/src/shard.spec.ts index 87702db92..4f3dc3c4c 100644 --- a/packages/shell-api/src/shard.spec.ts +++ b/packages/shell-api/src/shard.spec.ts @@ -2032,7 +2032,7 @@ describe('Shard', function () { ); expect((await sh.status()).value.shards[0].tags).to.deep.equal([]); }); - it('shows a full array if tags less than 20', async function () { + it('shows a full tag list when there are 20 or less tags', async function () { const db = instanceState.currentDb.getSiblingDB(dbName); await db.getCollection('coll').createIndex({ key: 1 }); for (let i = 0; i < 19; i++) { @@ -2052,7 +2052,7 @@ describe('Shard', function () { ).collections[ns].tags; expect(tags.length).to.equal(19); }); - it('shows tags as a string when there are too many', async function () { + it('cuts a tag list when there are more than 20 tags', async function () { await sh.addShardToZone(`${shardId}-0`, 'zone19'); await sh.updateZoneKeyRange(ns, { key: 190 }, { key: 200 }, 'zone19'); await sh.addShardTag(`${shardId}-0`, 'zone19'); @@ -2063,10 +2063,40 @@ describe('Shard', function () { ).collections; const tags = collections[ns].tags; - expect(tags.length).to.equal(1); - expect(tags[0]).to.equal( - 'too many tags to print, use verbose if you want to force print' - ); + expect(tags.length).to.equal(21); + expect( + !!tags.find( + (tag) => + tag === + 'too many tags to print, use verbose if you want to force print' + ) + ).to.equal(true); + }); + }); + describe('chunks', function () { + it('shows a full chunk list when there are 20 or less chunks', async function () { + for (let i = 0; i < 19; i++) { + await sh.splitAt(ns, { key: i + 1 }); + } + const chunks = (await sh.status()).value.databases.find( + (d) => d.database._id === 'test' + ).collections[ns].chunks; + expect(chunks.length).to.equal(20); + }); + + it('cuts a chunk list when there are more than 20 chunks', async function () { + await sh.splitAt(ns, { key: 20 }); + const chunks = (await sh.status()).value.databases.find( + (d) => d.database._id === 'test' + ).collections[ns].chunks; + expect(chunks.length).to.equal(21); + expect( + !!chunks.find( + (tag) => + tag === + 'too many chunks to print, use verbose if you want to force print' + ) + ).to.equal(true); }); }); describe('balancer', function () { @@ -2624,7 +2654,6 @@ describe('Shard', function () { ]); }); }); - describe('checkMetadataConsistency', function () { skipIfServerVersion(mongos, '< 7.0'); let db; From 7421aad0f2d8440617e7df43eb0a64df1c40219b Mon Sep 17 00:00:00 2001 From: Alena Khineika Date: Wed, 17 Jul 2024 13:01:23 +0200 Subject: [PATCH 04/11] test: clean-up ranges --- packages/shell-api/src/shard.spec.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/shell-api/src/shard.spec.ts b/packages/shell-api/src/shard.spec.ts index 4f3dc3c4c..70ada71a9 100644 --- a/packages/shell-api/src/shard.spec.ts +++ b/packages/shell-api/src/shard.spec.ts @@ -2071,6 +2071,25 @@ describe('Shard', function () { 'too many tags to print, use verbose if you want to force print' ) ).to.equal(true); + + for (let i = 0; i < 20; i++) { + expect( + ( + await sh.removeRangeFromZone( + ns, + { key: i * 10 }, + { key: i * 10 + 10 } + ) + ).ok + ).to.equal(1); + } + + const db = instanceState.currentDb.getSiblingDB(dbName); + await db.getCollection('coll').deleteMany({}); + + expect( + (await sh.removeShardFromZone(`${shardId}-0`, 'zone0')).ok + ).to.equal(1); }); }); describe('chunks', function () { From 9ec9062f336c0f8ef829d3ddb074511e73a4ac1d Mon Sep 17 00:00:00 2001 From: Alena Khineika Date: Wed, 17 Jul 2024 13:36:33 +0200 Subject: [PATCH 05/11] test: skip for less than 6.0 --- packages/shell-api/src/shard.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/shell-api/src/shard.spec.ts b/packages/shell-api/src/shard.spec.ts index 70ada71a9..dc939d9c5 100644 --- a/packages/shell-api/src/shard.spec.ts +++ b/packages/shell-api/src/shard.spec.ts @@ -2093,6 +2093,7 @@ describe('Shard', function () { }); }); describe('chunks', function () { + skipIfServerVersion(mongos, '<= 6.0'); it('shows a full chunk list when there are 20 or less chunks', async function () { for (let i = 0; i < 19; i++) { await sh.splitAt(ns, { key: i + 1 }); From c29ec6ae26bdcd1524f0f3889d38bacb2155e5ea Mon Sep 17 00:00:00 2001 From: Alena Khineika Date: Wed, 17 Jul 2024 15:02:17 +0200 Subject: [PATCH 06/11] test: try to remove shard from zone --- packages/shell-api/src/shard.spec.ts | 35 ++++++++++------------------ 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/packages/shell-api/src/shard.spec.ts b/packages/shell-api/src/shard.spec.ts index dc939d9c5..a05665f2d 100644 --- a/packages/shell-api/src/shard.spec.ts +++ b/packages/shell-api/src/shard.spec.ts @@ -2034,7 +2034,6 @@ describe('Shard', function () { }); it('shows a full tag list when there are 20 or less tags', async function () { const db = instanceState.currentDb.getSiblingDB(dbName); - await db.getCollection('coll').createIndex({ key: 1 }); for (let i = 0; i < 19; i++) { await db.getCollection('coll').insertOne({ key: 'A', value: i * 10 }); await sh.addShardToZone(`${shardId}-0`, `zone${i}`); @@ -2057,12 +2056,9 @@ describe('Shard', function () { await sh.updateZoneKeyRange(ns, { key: 190 }, { key: 200 }, 'zone19'); await sh.addShardTag(`${shardId}-0`, 'zone19'); - const databases = (await sh.status()).value.databases; - const collections = databases.find( + const tags = (await sh.status()).value.databases.find( (d) => d.database._id === 'test' - ).collections; - const tags = collections[ns].tags; - + ).collections[ns].tags; expect(tags.length).to.equal(21); expect( !!tags.find( @@ -2072,28 +2068,21 @@ describe('Shard', function () { ) ).to.equal(true); - for (let i = 0; i < 20; i++) { - expect( - ( - await sh.removeRangeFromZone( - ns, - { key: i * 10 }, - { key: i * 10 + 10 } - ) - ).ok - ).to.equal(1); - } - + // Cleanup. const db = instanceState.currentDb.getSiblingDB(dbName); await db.getCollection('coll').deleteMany({}); - - expect( - (await sh.removeShardFromZone(`${shardId}-0`, 'zone0')).ok - ).to.equal(1); + for (let i = 0; i < 20; i++) { + await sh.removeRangeFromZone( + ns, + { key: i * 10 }, + { key: i * 10 + 10 } + ); + await sh.removeShardTag(`${shardId}-0`, `zone${i}`); + await sh.removeShardFromZone(`${shardId}-0`, `zone${i}`); + } }); }); describe('chunks', function () { - skipIfServerVersion(mongos, '<= 6.0'); it('shows a full chunk list when there are 20 or less chunks', async function () { for (let i = 0; i < 19; i++) { await sh.splitAt(ns, { key: i + 1 }); From 2d67e83f943acb6db88e512a81222ee9482c4a9a Mon Sep 17 00:00:00 2001 From: Alena Khineika Date: Wed, 17 Jul 2024 15:18:21 +0200 Subject: [PATCH 07/11] test: try further range --- packages/shell-api/src/shard.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/shell-api/src/shard.spec.ts b/packages/shell-api/src/shard.spec.ts index a05665f2d..0393fc0c1 100644 --- a/packages/shell-api/src/shard.spec.ts +++ b/packages/shell-api/src/shard.spec.ts @@ -2084,7 +2084,7 @@ describe('Shard', function () { }); describe('chunks', function () { it('shows a full chunk list when there are 20 or less chunks', async function () { - for (let i = 0; i < 19; i++) { + for (let i = 1000; i < 1019; i++) { await sh.splitAt(ns, { key: i + 1 }); } const chunks = (await sh.status()).value.databases.find( @@ -2094,7 +2094,7 @@ describe('Shard', function () { }); it('cuts a chunk list when there are more than 20 chunks', async function () { - await sh.splitAt(ns, { key: 20 }); + await sh.splitAt(ns, { key: 1020 }); const chunks = (await sh.status()).value.databases.find( (d) => d.database._id === 'test' ).collections[ns].chunks; From 85972e720728639514d0885505390f1d470c1267 Mon Sep 17 00:00:00 2001 From: Alena Khineika Date: Wed, 17 Jul 2024 15:37:57 +0200 Subject: [PATCH 08/11] test: print chunks --- packages/shell-api/src/shard.spec.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/shell-api/src/shard.spec.ts b/packages/shell-api/src/shard.spec.ts index 0393fc0c1..47bda02fe 100644 --- a/packages/shell-api/src/shard.spec.ts +++ b/packages/shell-api/src/shard.spec.ts @@ -2084,7 +2084,16 @@ describe('Shard', function () { }); describe('chunks', function () { it('shows a full chunk list when there are 20 or less chunks', async function () { - for (let i = 1000; i < 1019; i++) { + const chunks0 = (await sh.status()).value.databases.find( + (d) => d.database._id === 'test' + ).collections[ns].chunks; + // eslint-disable-next-line no-console + console.log('chunks0----------------------'); + // eslint-disable-next-line no-console + console.log(chunks0); + // eslint-disable-next-line no-console + console.log('----------------------'); + for (let i = 1000; i < 1019 - chunks0.length; i++) { await sh.splitAt(ns, { key: i + 1 }); } const chunks = (await sh.status()).value.databases.find( From 7a4fe1d920c17c6e0a30310ef6e4a6eed3bd528b Mon Sep 17 00:00:00 2001 From: Alena Khineika Date: Wed, 17 Jul 2024 17:25:31 +0200 Subject: [PATCH 09/11] test: run chunk tests in isolation --- packages/shell-api/src/shard.spec.ts | 121 +++++++++++++++++++-------- 1 file changed, 86 insertions(+), 35 deletions(-) diff --git a/packages/shell-api/src/shard.spec.ts b/packages/shell-api/src/shard.spec.ts index 47bda02fe..e15eb4ac4 100644 --- a/packages/shell-api/src/shard.spec.ts +++ b/packages/shell-api/src/shard.spec.ts @@ -2082,41 +2082,6 @@ describe('Shard', function () { } }); }); - describe('chunks', function () { - it('shows a full chunk list when there are 20 or less chunks', async function () { - const chunks0 = (await sh.status()).value.databases.find( - (d) => d.database._id === 'test' - ).collections[ns].chunks; - // eslint-disable-next-line no-console - console.log('chunks0----------------------'); - // eslint-disable-next-line no-console - console.log(chunks0); - // eslint-disable-next-line no-console - console.log('----------------------'); - for (let i = 1000; i < 1019 - chunks0.length; i++) { - await sh.splitAt(ns, { key: i + 1 }); - } - const chunks = (await sh.status()).value.databases.find( - (d) => d.database._id === 'test' - ).collections[ns].chunks; - expect(chunks.length).to.equal(20); - }); - - it('cuts a chunk list when there are more than 20 chunks', async function () { - await sh.splitAt(ns, { key: 1020 }); - const chunks = (await sh.status()).value.databases.find( - (d) => d.database._id === 'test' - ).collections[ns].chunks; - expect(chunks.length).to.equal(21); - expect( - !!chunks.find( - (tag) => - tag === - 'too many chunks to print, use verbose if you want to force print' - ) - ).to.equal(true); - }); - }); describe('balancer', function () { it('reports balancer state', async function () { expect(Object.keys(await sh.isBalancerRunning())).to.include.members([ @@ -2712,4 +2677,90 @@ describe('Shard', function () { }); }); }); + + describe('integration chunks', function () { + let serviceProvider: CliServiceProvider; + let instanceState: ShellInstanceState; + let sh: Shard; + const dbName = 'test'; + const ns = `${dbName}.coll`; + const shardId = 'rs-shard1'; + + const [mongos, rs0, rs1] = startTestCluster( + 'shard', + // shards: 0 creates a setup without any initial shards + { topology: 'sharded', shards: 0 }, + { + topology: 'replset', + args: ['--replSet', `${shardId}-0`, '--shardsvr'], + }, + { topology: 'replset', args: ['--replSet', `${shardId}-1`, '--shardsvr'] } + ); + + before(async function () { + serviceProvider = await CliServiceProvider.connect( + await mongos.connectionString(), + dummyOptions, + {}, + new EventEmitter() + ); + instanceState = new ShellInstanceState(serviceProvider); + sh = new Shard(instanceState.currentDb); + + // check replset uninitialized + let members = await ( + await sh._database.getSiblingDB('config').getCollection('shards').find() + ) + .sort({ _id: 1 }) + .toArray(); + expect(members.length).to.equal(0); + + // add new shards + expect( + (await sh.addShard(`${shardId}-0/${await rs0.hostport()}`)).shardAdded + ).to.equal(`${shardId}-0`); + expect( + (await sh.addShard(`${shardId}-1/${await rs1.hostport()}`)).shardAdded + ).to.equal(`${shardId}-1`); + members = await ( + await sh._database.getSiblingDB('config').getCollection('shards').find() + ) + .sort({ _id: 1 }) + .toArray(); + expect(members.length).to.equal(2); + await sh._database.getSiblingDB(dbName).dropDatabase(); + await sh._database.getSiblingDB(dbName).createCollection('unsharded'); + await sh.enableSharding(dbName); + await sh.shardCollection(ns, { key: 1 }); + }); + + after(function () { + return serviceProvider.close(true); + }); + + it('shows a full chunk list when there are 20 or less chunks', async function () { + for (let i = 0; i < 19; i++) { + await sh.splitAt(ns, { key: i + 1 }); + } + const chunks = (await sh.status()).value.databases.find( + (d) => d.database._id === 'test' + ).collections[ns].chunks; + expect(chunks.length).to.equal(20); + }); + + it('cuts a chunk list when there are more than 20 chunks', async function () { + await sh.splitAt(ns, { key: 20 }); + const chunks = (await sh.status()).value.databases.find( + (d) => d.database._id === 'test' + ).collections[ns].chunks; + expect(chunks.length).to.equal(21); + expect( + !!chunks.find( + (tag) => + tag === + 'too many chunks to print, use verbose if you want to force print' + ) + ).to.equal(true); + }); + }); }); From fdbf08fa4c0daa39a8500d298ad99535aa655cf8 Mon Sep 17 00:00:00 2001 From: Alena Khineika Date: Thu, 18 Jul 2024 14:31:17 +0200 Subject: [PATCH 10/11] refactor: break after to many --- packages/shell-api/src/helpers.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/shell-api/src/helpers.ts b/packages/shell-api/src/helpers.ts index ff5d9523d..2e60644f4 100644 --- a/packages/shell-api/src/helpers.ts +++ b/packages/shell-api/src/helpers.ts @@ -611,6 +611,7 @@ export async function getPrintableShardStatus( chunksRes.push( 'too many chunks to print, use verbose if you want to force print' ); + break; } } @@ -631,6 +632,7 @@ export async function getPrintableShardStatus( tagsRes.push( 'too many tags to print, use verbose if you want to force print' ); + break; } } collRes.chunks = chunksRes; From ffd6f94263073fd0c7a2356a5142a17947f059e9 Mon Sep 17 00:00:00 2001 From: Alena Khineika Date: Thu, 18 Jul 2024 14:47:37 +0200 Subject: [PATCH 11/11] refactor: simplify expect --- packages/shell-api/src/shard.spec.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/shell-api/src/shard.spec.ts b/packages/shell-api/src/shard.spec.ts index e15eb4ac4..239114901 100644 --- a/packages/shell-api/src/shard.spec.ts +++ b/packages/shell-api/src/shard.spec.ts @@ -2061,12 +2061,10 @@ describe('Shard', function () { ).collections[ns].tags; expect(tags.length).to.equal(21); expect( - !!tags.find( - (tag) => - tag === - 'too many tags to print, use verbose if you want to force print' + tags.indexOf( + 'too many tags to print, use verbose if you want to force print' ) - ).to.equal(true); + ).to.equal(20); // Cleanup. const db = instanceState.currentDb.getSiblingDB(dbName); @@ -2755,12 +2753,10 @@ describe('Shard', function () { ).collections[ns].chunks; expect(chunks.length).to.equal(21); expect( - !!chunks.find( - (tag) => - tag === - 'too many chunks to print, use verbose if you want to force print' + chunks.indexOf( + 'too many chunks to print, use verbose if you want to force print' ) - ).to.equal(true); + ).to.equal(20); }); }); });