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:29:39 UTC
[couchdb] branch 3939-multipart-replicated-changes-race updated: Add an integration test
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
The following commit(s) were added to refs/heads/3939-multipart-replicated-changes-race by this push:
new 90298de Add an integration test
90298de is described below
commit 90298debd3a9ef3509e7266feae0d439244862c0
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..e661bd6 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}/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"