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 2022/02/23 18:40:41 UTC

[couchdb] branch 3939-multipart-replicated-changes-race updated (90298de -> e85e343)

This is an automated email from the ASF dual-hosted git repository.

kocolosk pushed a change to branch 3939-multipart-replicated-changes-race
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


 discard 90298de  Add an integration test
     new e85e343  Add an integration test

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (90298de)
            \
             N -- N -- N   refs/heads/3939-multipart-replicated-changes-race (e85e343)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 test/elixir/test/attachments_multipart_test.exs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

[couchdb] 01/01: Add an integration test

Posted by ko...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kocolosk pushed a commit to branch 3939-multipart-replicated-changes-race
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit e85e343592827d3bf040c563bc0b211e4cac1eb5
Author: Adam Kocoloski <ko...@apache.org>
AuthorDate: Wed Feb 23 13:27:14 2022 -0500

    Add an integration test
    
    This doesn't actually work as you'd expect. The response for the
    new_edits=false request does return quickly, but the request body
    is never consumed and so the _next_ request on the wire will hang.
---
 test/elixir/test/attachments_multipart_test.exs | 57 +++++++++++++++++++++++++
 test/elixir/test/config/suite.elixir            |  3 +-
 2 files changed, 59 insertions(+), 1 deletion(-)

diff --git a/test/elixir/test/attachments_multipart_test.exs b/test/elixir/test/attachments_multipart_test.exs
index f7d5d95..c5cd8fc 100644
--- a/test/elixir/test/attachments_multipart_test.exs
+++ b/test/elixir/test/attachments_multipart_test.exs
@@ -260,6 +260,63 @@ defmodule AttachmentMultipartTest do
     )
   end
 
+  @tag :with_db
+  test "multipart attachments with new_edits=false", context do
+    db_name = context[:db_name]
+
+    document = """
+    {
+      "body": "This is a body.",
+      "_attachments": {
+        "foo.txt": {
+          "follows": true,
+          "content_type": "application/test",
+          "length": 21
+        }
+      }
+    }
+    """
+
+    multipart_data =
+      "--abc123\r\n" <>
+        "content-type: application/json\r\n" <>
+        "\r\n" <>
+        document <>
+        "\r\n--abc123\r\n" <>
+        "\r\n" <>
+        "this is 21 chars long" <>
+        "\r\n--abc123--epilogue"
+
+    resp =
+      Couch.put(
+        "/#{db_name}/multipart_replicated_changes",
+        body: multipart_data,
+        headers: ["Content-Type": "multipart/related;boundary=\"abc123\""]
+      )
+
+    assert resp.status_code in [201, 202]
+    assert resp.body["ok"] == true
+
+    rev = resp.body["rev"]
+
+    resp = Couch.get("/#{db_name}/multipart_replicated_changes/foo.txt")
+
+    assert resp.body == "this is 21 chars long"
+
+    # https://github.com/apache/couchdb/issues/3939
+    # Repeating the request should not hang
+    resp =
+      Couch.put(
+        "/#{db_name}/multipart_replicated_changes?new_edits=false&rev=#{rev}",
+        body: multipart_data,
+        headers: ["Content-Type": "multipart/related;boundary=\"abc123\""]
+      )
+
+    assert resp.status_code in [201, 202]
+    assert resp.body["ok"] == true
+
+  end
+
   defp test_multipart_att_compression(dbname) do
     doc = %{
       "_id" => "foobar"
diff --git a/test/elixir/test/config/suite.elixir b/test/elixir/test/config/suite.elixir
index 2e97553..e071da8 100644
--- a/test/elixir/test/config/suite.elixir
+++ b/test/elixir/test/config/suite.elixir
@@ -10,7 +10,8 @@
   ],
   "AttachmentMultipartTest": [
     "manages attachments multipart requests successfully",
-    "manages compressed attachments successfully"
+    "manages compressed attachments successfully",
+    "multipart attachments with new_edits=false"
   ],
   "AttachmentNamesTest": [
     "saves attachment names successfully"