summaryrefslogtreecommitdiff
path: root/jstests/core
diff options
context:
space:
mode:
authorMartin Bligh <mbligh@mongodb.com>2015-11-11 17:01:03 -0500
committerMartin Bligh <mbligh@mongodb.com>2015-11-11 17:01:03 -0500
commit5dd9558ed687faa62037cd0f9774a7bd45c62b84 (patch)
treed781826b203621e59354db824bcce15262daca67 /jstests/core
parent273aca8cdff4e23f62244b2537b72a12269b6370 (diff)
downloadmongo-5dd9558ed687faa62037cd0f9774a7bd45c62b84.tar.gz
SERVER-21276: Fix various issues with top
Diffstat (limited to 'jstests/core')
-rw-r--r--jstests/core/top.js12
1 files changed, 5 insertions, 7 deletions
diff --git a/jstests/core/top.js b/jstests/core/top.js
index 6807065cf2b..7fa0dbac39c 100644
--- a/jstests/core/top.js
+++ b/jstests/core/top.js
@@ -14,7 +14,7 @@ testColl.remove({x:0});
// get top statistics for the test collection
function getTop() {
- return testDB.adminCommand("top").totals[testColl.getFullName()];
+ return testDB.adminCommand("top").totals[testColl.getFullName()];
}
// This variable is used to get differential output
@@ -42,10 +42,7 @@ var checked = { }
function checkStats(key, expected) {
checked[key]++
var actual = diffTop(key).count;
- if (actual != expected) {
- print("top reports wrong count for " + key +
- ": actual " + actual + " /= expected " + expected);
- }
+ assert.eq(actual, expected, "top reports wrong count for " + key);
}
// Insert
@@ -53,6 +50,7 @@ for(i = 0; i < numRecords; i++) {
testColl.insert({_id:i});
}
checkStats("insert", numRecords);
+checkStats("writeLock", numRecords);
// Update
for(i = 0; i < numRecords; i++) {
@@ -63,7 +61,7 @@ checkStats("update", numRecords);
// Queries
var query = { }
for(i = 0; i < numRecords; i++) {
- query[i] = testColl.find({x : {$gte:i}}).batchSize(1);
+ query[i] = testColl.find({x : {$gte:i}}).batchSize(2);
assert.eq(query[i].next()._id, i);
}
checkStats("queries" ,numRecords);
@@ -77,7 +75,7 @@ for(i = 0; i < numRecords / 2; i++) {
}
checkStats("getmore", numRecords);
-// Remove
+// Remove
for(i = 0; i < numRecords; i++) {
testColl.remove({_id : 1});
}