1
0
Fork 0

try to fix test

This commit is contained in:
jsteemann 2018-10-09 10:55:48 +02:00
parent d19f5fac49
commit 048d322352
1 changed files with 7 additions and 20 deletions

View File

@ -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();