summaryrefslogtreecommitdiff
path: root/share/www/script/test/stats.js
diff options
context:
space:
mode:
Diffstat (limited to 'share/www/script/test/stats.js')
-rw-r--r--share/www/script/test/stats.js31
1 files changed, 16 insertions, 15 deletions
diff --git a/share/www/script/test/stats.js b/share/www/script/test/stats.js
index 793b390d..6fb0fbba 100644
--- a/share/www/script/test/stats.js
+++ b/share/www/script/test/stats.js
@@ -30,7 +30,7 @@ couchTests.stats = function(debug) {
_id:"_design/test", // turn off couch.js id escaping?
language: "javascript",
views: {
- all_docs: {map: "function(doc) {emit(doc.integer, null);}"},
+ all_docs: {map: "function(doc) {emit(doc.integer, null);}"}
}
};
db.save(designDoc);
@@ -81,19 +81,17 @@ couchTests.stats = function(debug) {
var pre_dbs = getStat("couchdb", "open_databases").current || 0;
var pre_files = getStat("couchdb", "open_os_files").current || 0;
- // We have to make sure that as we open the max'th database
- // that we've waited for more than 1 second since opening
- // the first database so that any delayed commits will be
- // flushed.
var triggered = false;
var db = null;
for(var i = 0; i < max*2; i++) {
- try {
- db = newDb("test_suite_db_" + i, true);
- } catch(e) {
- triggered = true;
- CouchDB.request("GET", "/_sleep?time=1500");
- db = newDb("test_suite_db_" + i, true);
+ while (true) {
+ try {
+ db = newDb("test_suite_db_" + i, true);
+ break;
+ } catch(e) {
+ // all_dbs_active error!
+ triggered = true;
+ }
}
// Trigger a delayed commit
@@ -162,12 +160,15 @@ couchTests.stats = function(debug) {
runTest("couchdb", "database_writes", {
run: function(db) {
- CouchDB.request("POST", "/test_suite_db", {body: '{"a": "1"}'})
+ CouchDB.request("POST", "/test_suite_db", {
+ headers: {"Content-Type": "application/json"},
+ body: '{"a": "1"}'
+ });
},
test: function(before, after) {
TEquals(before+1, after, "POST'ing new docs increments doc writes.");
}
- })
+ });
runTest("couchdb", "database_writes", {
setup: function(db) {db.save({"_id": "test"});},
@@ -246,7 +247,7 @@ couchTests.stats = function(debug) {
});
runTest("httpd", "temporary_view_reads", {
- run: function(db) {db.query(function(doc) {emit(doc._id)})},
+ run: function(db) { db.query(function(doc) { emit(doc._id); }); },
test: function(before, after) {
TEquals(before+1, after, "Temporary views have their own counter.");
}
@@ -260,7 +261,7 @@ couchTests.stats = function(debug) {
});
runTest("httpd", "view_reads", {
- run: function(db) {db.query(function(doc) {emit(doc._id)});},
+ run: function(db) { db.query(function(doc) { emit(doc._id); }); },
test: function(before, after) {
TEquals(before, after, "Temporary views don't affect permanent views.");
}