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

fix bug in drop_sharded_dbs.js where we assert.neq() on an entire array and its member

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.5.6
    • Affects Version/s: 3.5.5
    • Component/s: Sharding
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Sharding 2017-04-17
    • 0

      Presumably the assert.neq() here should be on dbs[i], not just 'dbs'.

      https://github.com/mongodb/mongo/blob/73d3473f/jstests/sharding/drop_sharded_db.js#L42

          // Drop the non-suffixed db and ensure that it is the only one that was dropped.
          dbA.dropDatabase();
          var dbs = mongos.getDBNames();
          for (var i = 0; i < dbs.length; i++) {
              assert.neq(dbs, "" + dbA);
          }
      

      Also, we should assert.commandWorked() on the dropDatabase().

      Failing to assert.commandWorked() can lead to the test failing on a later line, as in BF-4953:

      https://github.com/mongodb/mongo/blob/73d3473f/jstests/sharding/drop_sharded_db.js#L45

          assert.eq(0, config.databases.count({_id: dbA.getName()}));
      

      It's particularly misleading because the for-loop with the 'dbs' bug fails to catch when the db was not actually deleted, so it seems like an issue with the count().

            Assignee:
            esha.maharishi@mongodb.com Esha Maharishi (Inactive)
            Reporter:
            esha.maharishi@mongodb.com Esha Maharishi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: