diff options
author | Damien F. Katz <damien@apache.org> | 2008-04-04 03:10:34 +0000 |
---|---|---|
committer | Damien F. Katz <damien@apache.org> | 2008-04-04 03:10:34 +0000 |
commit | afaa5d561826ccf7cab4fde2af9ad39d32ea4d0d (patch) | |
tree | e94b0bca1ee069f95f34c66fbcd21c2a03061ba5 /share | |
parent | 88627dd6d98acd1a6700994037f4da1362dbcb3e (diff) |
compaction code, not hooked up to webserver yet
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@644593 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share')
-rw-r--r-- | share/www/script/couch_tests.js | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/share/www/script/couch_tests.js b/share/www/script/couch_tests.js index bd159310..d1c93dd8 100644 --- a/share/www/script/couch_tests.js +++ b/share/www/script/couch_tests.js @@ -191,10 +191,13 @@ var tests = { // keep number lowish for now to keep tests fasts. Crank up manually to // to really test. - var numDocsToCreate = 500; + var numDocsToCreate = 5000; - var docs = makeDocs(numDocsToCreate); - T(db.bulkSave(docs).ok); + for(var i=0; i < numDocsToCreate; i += 100) { + var createNow = Math.min(numDocsToCreate - i, 100); + var docs = makeDocs(i, i + createNow); + T(db.bulkSave(docs).ok); + } // query all documents, and return the doc.integer member as a key. results = db.query(function(doc){ map(doc.integer, null) }); @@ -401,7 +404,7 @@ var tests = { } T(db.save(designDoc).ok); - T(db.bulkSave(makeDocs(numDocs)).ok); + T(db.bulkSave(makeDocs(1, numDocs)).ok); for (var loop = 0; loop < 2; loop++) { var rows = db.view("test/all_docs").rows @@ -543,7 +546,7 @@ var tests = { db.createDb(); if (debug) debugger; - var docs = makeDocs(100); + var docs = makeDocs(0, 100); T(db.bulkSave(docs).ok); var queryFun = function(doc) { map(doc.integer, null) }; @@ -607,7 +610,7 @@ var tests = { db.createDb(); if (debug) debugger; - var docs = makeDocs(2); + var docs = makeDocs(1, 2); T(db.bulkSave(docs).ok); // make sure that attempting to change the document throws an error @@ -689,7 +692,7 @@ var tests = { dbB.deleteDb(); dbB.createDb(); - var docs = makeDocs(numDocs); + var docs = makeDocs(1, numDocs); T(dbA.bulkSave(docs).ok); T(CouchDB.replicate(A, B).ok); @@ -840,10 +843,10 @@ var tests = { }; -function makeDocs(n, templateDoc) { +function makeDocs(start, end, templateDoc) { var templateDocSrc = templateDoc ? templateDoc.toSource() : "{}" var docs = [] - for(var i=0; i<n; i++) { + for(var i=start; i<end; i++) { var newDoc = eval("(" + templateDocSrc + ")"); newDoc._id = (i).toString(); newDoc.integer = i |