got to looking at the test while diagnosing a test failure. want to update the understandability of the test.
make the following changes:
diff --git a/jstests/core/index_many2.js b/jstests/core/index_many2.js index 70fada7396..5ff9349b20 100644 --- a/jstests/core/index_many2.js +++ b/jstests/core/index_many2.js @@ -15,19 +15,31 @@ function make(n) { return x; } +jsTestLog("Creating 1000 indexes."); + +// Try to create 1000 indexes. Only 64 will succeed because 64 is the maximum number of indexes +// allowed on a collection. for (i = 1; i < 1000; i++) { + // Cannot assert success because only 64 will succeed. t.createIndex(make(i)); } -assert.eq(64, t.getIndexKeys().length, "A2"); - num = t.getIndexKeys().length; +assert.eq(64, num, "Expected 64 keys, found: " + num); + +jsTestLog("Dropping an index."); + +assert.commandWorked(t.dropIndex(make(num - 1))); +assert.eq(num - 1, t.getIndexKeys().length, "After dropping an index, there should be 63 left."); + +jsTestLog("Creating an index."); + +assert.commandWorked(t.createIndex({z: 1})); +assert.eq(num, t.getIndexKeys().length, "Expected 64 indexes."); -t.dropIndex(make(num - 1)); -assert.eq(num - 1, t.getIndexKeys().length, "B0"); +jsTestLog("Dropping all indexes with wildcard '*'"); -t.createIndex({z: 1}); -assert.eq(num, t.getIndexKeys().length, "B1"); +assert.commandWorked(t.dropIndexes("*")); +assert.eq(1, t.getIndexKeys().length, "Expected only one index after dropping indexes via '*'"); -t.dropIndexes("*"); -assert.eq(1, t.getIndexKeys().length, "C1"); +jsTestLog("Test index_many2.js complete.");
Update:
well, minus the assert.commandWorked additions. That causes passthrough suites to fail...
- related to
-
SERVER-59096 clean up tests: index_many2.js countc.js update_addToSet.js geo_uniqueDocs2.js
- Closed