You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by fd...@apache.org on 2011/07/08 20:02:58 UTC

svn commit: r1144407 - in /couchdb/trunk: share/www/script/test/replication.js src/couchdb/couch_httpd_replicator.erl

Author: fdmanana
Date: Fri Jul  8 18:02:58 2011
New Revision: 1144407

URL: http://svn.apache.org/viewvc?rev=1144407&view=rev
Log:
Fix replication.js failures in OTP R14B03

The fix to make the test work on OTP releases older
than R14B03 (revision 1143805) actually broke the
test on R14B03.
Now verified it works on R14B03 and previous releases.


Modified:
    couchdb/trunk/share/www/script/test/replication.js
    couchdb/trunk/src/couchdb/couch_httpd_replicator.erl

Modified: couchdb/trunk/share/www/script/test/replication.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/replication.js?rev=1144407&r1=1144406&r2=1144407&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/replication.js (original)
+++ couchdb/trunk/share/www/script/test/replication.js Fri Jul  8 18:02:58 2011
@@ -523,11 +523,16 @@ couchTests.replication = function(debug)
     // after the child terminates, so cancel the replication to delete the
     // child spec in those OTP releases, otherwise since_seq will have no
     // effect.
-    CouchDB.replicate(
-      dbPairs[i].source,
-      dbPairs[i].target,
-      {body: {cancel: true}}
-    );
+    try {
+      CouchDB.replicate(
+        dbPairs[i].source,
+        dbPairs[i].target,
+        {body: {cancel: true}}
+      );
+    } catch (x) {
+      // OTP R14B03 onwards
+      TEquals("not found", x.error);
+    }
     repResult = CouchDB.replicate(
       dbPairs[i].source,
       dbPairs[i].target,
@@ -536,11 +541,16 @@ couchTests.replication = function(debug)
     // Same reason as before. But here we don't want since_seq to affect
     // subsequent replications, so we need to delete the child spec from the
     // supervisor (since_seq is not used to calculate the replication ID).
-    CouchDB.replicate(
-      dbPairs[i].source,
-      dbPairs[i].target,
-      {body: {cancel: true}}
-    );
+    try {
+      CouchDB.replicate(
+        dbPairs[i].source,
+        dbPairs[i].target,
+        {body: {cancel: true}}
+      );
+    } catch (x) {
+      // OTP R14B03 onwards
+      TEquals("not found", x.error);
+    }
     TEquals(true, repResult.ok);
     TEquals(2, repResult.history[0].missing_checked);
     TEquals(2, repResult.history[0].missing_found);

Modified: couchdb/trunk/src/couchdb/couch_httpd_replicator.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_replicator.erl?rev=1144407&r1=1144406&r2=1144407&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_replicator.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_replicator.erl Fri Jul  8 18:02:58 2011
@@ -36,6 +36,9 @@ handle_req(#httpd{method = 'POST', user_
         send_json(
             Req, 404,
             {[{error, to_binary(Error)}, {reason, to_binary(Reason)}]});
+    {error, not_found} ->
+        % Tried to cancel a replication that didn't exist.
+        send_json(Req, 404, {[{error, <<"not found">>}]});
     {error, Reason} ->
         send_json(Req, 500, {[{error, to_binary(Reason)}]});
     {ok, {cancelled, RepId}} ->