Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-58890

Improve debug-ability of index_many2.js

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.1.0
    • Component/s: None
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Sprint:
      Execution Team 2021-08-09
    • Linked BF Score:
      150

      Description

      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...

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dianna.hohensee Dianna Hohensee
              Reporter:
              dianna.hohensee Dianna Hohensee
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: