diff --git a/tests/js/server/shell/shell-skiplist-index-selectivity-rocksdb-noncluster.js b/tests/js/server/shell/shell-skiplist-index-selectivity-rocksdb-noncluster.js index d7c9556b03..5086c99056 100644 --- a/tests/js/server/shell/shell-skiplist-index-selectivity-rocksdb-noncluster.js +++ b/tests/js/server/shell/shell-skiplist-index-selectivity-rocksdb-noncluster.js @@ -34,8 +34,8 @@ var internal = require("internal"); function SkiplistIndexSuite() { 'use strict'; - var cn = "UnitTestsCollectionSkip"; - var collection = null; + const cn = "UnitTestsCollectionSkip"; + let collection = null; return { @@ -53,16 +53,8 @@ function SkiplistIndexSuite() { //////////////////////////////////////////////////////////////////////////////// tearDown : function () { - // try...catch is necessary as some tests delete the collection itself! - try { - collection.unload(); - collection.drop(); - } - catch (err) { - } - + collection.drop(); collection = null; - internal.wait(0.0); }, //////////////////////////////////////////////////////////////////////////////// @@ -79,11 +71,11 @@ function SkiplistIndexSuite() { collection.save(docs); idx = collection.ensureSkiplist("value"); internal.waitForEstimatorSync(); // make sure estimates are consistent - idx = collection.ensureSkiplist("value"); + idx = collection.ensureSkiplist("value"); // fetch new estimates let oldEstimate = idx.selectivityEstimate; - assertTrue(oldEstimate > 0); - assertTrue(oldEstimate < 1); + assertTrue(oldEstimate >= 0); + assertTrue(oldEstimate <= 1); try { internal.db._executeTransaction({ collections: {write: cn}, @@ -103,22 +95,17 @@ function SkiplistIndexSuite() { } catch (e) { assertEqual(e.errorMessage, "banana"); // Insert failed. - // Validate that estimate is non modified + // Validate that estimate is non-modified idx = collection.ensureSkiplist("value"); internal.waitForEstimatorSync(); // make sure estimates are consistent assertEqual(idx.selectivityEstimate, oldEstimate); } }, - }; } -//////////////////////////////////////////////////////////////////////////////// -/// @brief executes the test suites -//////////////////////////////////////////////////////////////////////////////// - jsunity.run(SkiplistIndexSuite); return jsunity.done();