0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00
This commit is contained in:
Jonathan Reams 2016-11-03 17:01:20 -04:00
parent 3c5f3e81ed
commit 3d0f477cb2
2 changed files with 20 additions and 9 deletions

View File

@ -9,7 +9,7 @@
* 5.) Using "listDatabases" verify only "repairDB" exists.
*/
(function () {
(function() {
"use strict";
// 1. Drop databases.
@ -30,16 +30,27 @@
// 3. Repair "repairdb", verify error.
var res1 = casing2db.repairDatabase();
assert.eq(0, res1["ok"]);
assert.eq(true, res1["errmsg"].indexOf("Database does not exist. Database: `repair_database_input_validation_repairdb`") > -1);
assert.eq(
true,
res1["errmsg"].indexOf(
"Database does not exist. Database: `repair_database_input_validation_repairdb`") > -1);
// 4. Repair "nonExistentDb", verify error.
var res2 = nonExistentDb.repairDatabase();
assert.eq(0, res2["ok"]);
assert.eq(true, res2["errmsg"].indexOf("Database does not exist. Database: `repair_database_input_validation_nonExistentDb`") > -1);
assert.eq(
true,
res2["errmsg"].indexOf(
"Database does not exist. Database: `repair_database_input_validation_nonExistentDb`") >
-1);
// 5. Verify only "repairDB" exists.
var dbNames = db.getMongo().getDBNames()
assert.contains("repair_database_input_validation_REPAIRDB", dbNames, "Should contain REPAIRDB");
assert.eq(false, dbNames.some(function(x) { x == "repair_database_input_validation_repairdb" }));
assert.eq(false, dbNames.some(function(x) { x == "repair_database_input_validation_nonExistentDb" }));
var dbNames = db.getMongo().getDBNames() assert.contains(
"repair_database_input_validation_REPAIRDB", dbNames, "Should contain REPAIRDB");
assert.eq(false, dbNames.some(function(x) {
x == "repair_database_input_validation_repairdb"
}));
assert.eq(false, dbNames.some(function(x) {
x == "repair_database_input_validation_nonExistentDb"
}));
})();

View File

@ -64,8 +64,8 @@ function assertTopDiffEq(coll, lastTop, key, expectedCountDiff) {
// TODO (JBR for SERVER-26812): We don't currently guarantee that the time will not be zero
// which causes occaisional test failures here. If we change the timers in top to use a
// monotonic clock in SERVER-26812, then we can uncomment these.
//assert.gte(diff.time, 0, "non-decreasing time");
//assert.eq(diff.count !== 0, diff.time > 0, "non-zero time iff non-zero count");
// assert.gte(diff.time, 0, "non-decreasing time");
// assert.eq(diff.count !== 0, diff.time > 0, "non-zero time iff non-zero count");
assert.eq(diff.count, expectedCountDiff, "top reports wrong count for " + key);
return thisTop;
}