diff options
Diffstat (limited to 'share/www/script')
-rw-r--r-- | share/www/script/couch.js | 6 | ||||
-rw-r--r-- | share/www/script/couch_tests.js | 9 |
2 files changed, 14 insertions, 1 deletions
diff --git a/share/www/script/couch.js b/share/www/script/couch.js index 505d653f..e1806d6f 100644 --- a/share/www/script/couch.js +++ b/share/www/script/couch.js @@ -108,6 +108,12 @@ function CouchDB(name, httpHeaders) { } return result; } + + this.ensureFullCommit = function() { + this.last_req = this.request("POST", this.uri + "_ensure_full_commit"); + CouchDB.maybeThrowError(this.last_req); + return JSON.parse(this.last_req.responseText); + } // Applies the map function to the contents of database and returns the results. this.query = function(mapFun, reduceFun, options, keys) { diff --git a/share/www/script/couch_tests.js b/share/www/script/couch_tests.js index f553435e..dbc70325 100644 --- a/share/www/script/couch_tests.js +++ b/share/www/script/couch_tests.js @@ -130,7 +130,11 @@ var tests = { T(db.open(existingDoc._id, {rev: existingDoc._rev}) != null); // make sure restart works + T(db.ensureFullCommit().ok); restartServer(); + + // make sure we can still open + T(db.open(existingDoc._id, {rev: existingDoc._rev}) != null); }, all_docs: function(debug) { var db = new CouchDB("test_suite_db"); @@ -1173,6 +1177,7 @@ var tests = { } T(db.view("test/no_docs").total_rows == 0) T(db.view("test/single_doc").total_rows == 1) + T(db.ensureFullCommit().ok); restartServer(); }; @@ -1214,7 +1219,8 @@ var tests = { T(db.deleteDoc(designDoc).ok); T(db.open(designDoc._id) == null); T(db.view("test/no_docs") == null); - + + T(db.ensureFullCommit().ok); restartServer(); T(db.open(designDoc._id) == null); T(db.view("test/no_docs") == null); @@ -2327,6 +2333,7 @@ var tests = { // compaction isn't instantaneous, loop until done while (db.info().compact_running) {}; + T(db.ensureFullCommit().ok); restartServer(); var xhr = CouchDB.request("GET", "/test_suite_db/bin_doc/foo.txt"); T(xhr.responseText == "This is a base64 encoded text") |