You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ko...@apache.org on 2010/08/08 02:37:17 UTC

svn commit: r983330 - /couchdb/trunk/share/www/script/test/delayed_commits.js

Author: kocolosk
Date: Sun Aug  8 00:37:16 2010
New Revision: 983330

URL: http://svn.apache.org/viewvc?rev=983330&view=rev
Log:
failing test case for COUCHDB-844

Modified:
    couchdb/trunk/share/www/script/test/delayed_commits.js

Modified: couchdb/trunk/share/www/script/test/delayed_commits.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/delayed_commits.js?rev=983330&r1=983329&r2=983330&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/delayed_commits.js (original)
+++ couchdb/trunk/share/www/script/test/delayed_commits.js Sun Aug  8 00:37:16 2010
@@ -122,4 +122,33 @@ couchTests.delayed_commits = function(de
       }
     });
 
+
+  // Test that a conflict can't cause delayed commits to fail
+  run_on_modified_server(
+    [{section: "couchdb",
+      key: "delayed_commits",
+      value: "true"}],
+
+    function() {
+      //First save a document and commit it
+      T(db.save({_id:"6",a:2,b:4}).ok);
+      T(db.ensureFullCommit().ok);
+      //Generate a conflict
+      try {
+        db.save({_id:"6",a:2,b:4});
+      } catch( e) {
+        T(e.error == "conflict");
+      }
+      //Wait for the delayed commit interval to pass
+      var time = new Date();
+      while(new Date() - time < 2000);
+      //Save a new doc
+      T(db.save({_id:"7",a:2,b:4}).ok);
+      //Wait for the delayed commit interval to pass
+      var time = new Date();
+      while(new Date() - time < 2000);
+      //Crash the server and make sure the last doc was written
+      restartServer();
+      T(db.open("7") != null);
+    });
 };