This is an automated email from the ASF dual-hosted git repository. jiahuili430 pushed a commit to branch fix-elixir-tests in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 35fc5f50e9776c88be11c3840e54743d183f3f6a Author: Jiahui Li <[email protected]> AuthorDate: Thu Dec 11 14:37:37 2025 -0600 Fix tests --- test/elixir/test/cluster_with_quorum_test.exs | 20 ++++++------ test/elixir/test/cluster_without_quorum_test.exs | 41 ++++++++++++------------ 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/test/elixir/test/cluster_with_quorum_test.exs b/test/elixir/test/cluster_with_quorum_test.exs index fc3b28a0b..718e3f41b 100644 --- a/test/elixir/test/cluster_with_quorum_test.exs +++ b/test/elixir/test/cluster_with_quorum_test.exs @@ -7,14 +7,14 @@ defmodule WithQuorumTest do Test CouchDB API in a cluster without quorum. """ @tag :with_db_name - test "Creating/Deleting DB should return 201-Created/202-Acepted", context do + test "Creating/Deleting DB should return 201-Created/200-OK", context do db_name = context[:db_name] resp = Couch.put("/#{db_name}") msg = "Should return 201-Created" assert resp.status_code in [201, 202], msg resp = Couch.delete("/#{db_name}") - msg = "Should return 202-Acepted" - assert resp.status_code == 202, msg + msg = "Should return 200-OK" + assert resp.status_code == 200, msg end @tag :with_db_name @@ -45,7 +45,7 @@ defmodule WithQuorumTest do end @tag :with_db_name - test "Creating-Updating/Deleting doc with overriden quorum should return 202-Acepted/200-OK", + test "Creating-Updating/Deleting doc with overridden quorum should return 202-Accepted/200-OK", context do db_name = context[:db_name] Couch.put("/#{db_name}") @@ -57,7 +57,7 @@ defmodule WithQuorumTest do body: %{:_id => "0", :a => 1} ) - msg = "Should return 202-Acepted" + msg = "Should return 202-Accepted" assert resp.status_code == 202, msg resp = Couch.get("/#{context[:db_name]}/0") @@ -70,7 +70,7 @@ defmodule WithQuorumTest do body: %{:_id => "0", :_rev => rev, :a => 2} ) - msg = "Should return 202-Acepted" + msg = "Should return 202-Accepted" assert resp.status_code == 202, msg resp = Couch.get("/#{context[:db_name]}/0") @@ -114,12 +114,12 @@ defmodule WithQuorumTest do end @tag :with_db_name - test "Bulk docs overriden quorum should return 202-Acepted", context do + test "Bulk docs overridden quorum should return 202-Accepted", context do db_name = context[:db_name] Couch.put("/#{db_name}") docs = create_docs(@doc_range) resp = Couch.post("/#{db_name}/_bulk_docs", query: %{:w => 3}, body: %{docs: docs}) - msg = "Should return 202-Acepted" + msg = "Should return 202-Accepted" assert resp.status_code == 202, msg Couch.delete("/#{db_name}") @@ -152,7 +152,7 @@ defmodule WithQuorumTest do end @tag :with_db_name - test "Attachments overriden quorum should return 202-Acepted", context do + test "Attachments overridden quorum should return 202-Accepted", context do db_name = context[:db_name] Couch.put("/#{db_name}") resp = Couch.post("/#{context[:db_name]}", body: %{:_id => "0"}) @@ -166,7 +166,7 @@ defmodule WithQuorumTest do headers: ["Content-Type": "text/plain;charset=utf-8"] ) - msg = "Should return 202-Acepted" + msg = "Should return 202-Accepted" assert resp.status_code == 202, msg rev = resp.body["rev"] diff --git a/test/elixir/test/cluster_without_quorum_test.exs b/test/elixir/test/cluster_without_quorum_test.exs index f80b6ac27..16341c6ec 100644 --- a/test/elixir/test/cluster_without_quorum_test.exs +++ b/test/elixir/test/cluster_without_quorum_test.exs @@ -7,23 +7,24 @@ defmodule WithoutQuorumTest do Test CouchDB API in a cluster without quorum. """ @tag :with_db_name - test "Creating/Deleting DB should return 202-Accepted", context do + test "Creating/Deleting DB should return 201-Created/200-OK", context do db_name = context[:db_name] resp = Couch.put("/#{db_name}") - msg = "Should return 202-Accepted" - assert resp.status_code == 202, msg + msg = "Should return 201-Created" + assert resp.status_code == 201, msg resp = Couch.delete("/#{db_name}") - assert resp.status_code == 202, msg + msg = "Should return 200-OK" + assert resp.status_code == 200, msg end @tag :with_db_name - test "Creating/Updating/Deleting doc should return 202-Accepted", context do + test "Creating/Updating/Deleting doc should return 201-Created/200-OK", context do db_name = context[:db_name] Couch.put("/#{db_name}") resp = Couch.post("/#{context[:db_name]}", body: %{:_id => "0", :a => 1}) - msg = "Should return 202-Accepted" - assert resp.status_code == 202, msg + msg = "Should return 201-Created" + assert resp.status_code == 201, msg resp = Couch.get("/#{context[:db_name]}/0") rev = resp.body["_rev"] @@ -31,14 +32,14 @@ defmodule WithoutQuorumTest do resp = Couch.put("/#{context[:db_name]}/0", body: %{:_id => "0", :_rev => rev, :a => 2}) - msg = "Should return 202-Accepted" - assert resp.status_code == 202, msg + msg = "Should return 201-Created" + assert resp.status_code == 201, msg resp = Couch.get("/#{context[:db_name]}/0") rev = resp.body["_rev"] resp = Couch.delete("/#{context[:db_name]}/0", query: %{:rev => rev}) - msg = "Should return 202-Accepted" - assert resp.status_code == 202, msg + msg = "Should return 200-OK" + assert resp.status_code == 200, msg Couch.delete("/#{db_name}") end @@ -82,7 +83,7 @@ defmodule WithoutQuorumTest do end @tag :with_db_name - test "Copy doc should return 202-Accepted", context do + test "Copy doc should return 201-Created", context do db_name = context[:db_name] Couch.put("/#{db_name}") @@ -93,21 +94,21 @@ defmodule WithoutQuorumTest do headers = [Destination: "1"] resp = Couch.request(:copy, "/#{context[:db_name]}/0", headers: headers) - msg = "Should return 202-Accepted" - assert resp.status_code == 202, msg + msg = "Should return 201-Created" + assert resp.status_code == 201, msg Couch.delete("/#{db_name}") end @doc_range 1..5 @tag :with_db_name - test "Bulk docs should return 202-Accepted", context do + test "Bulk docs should return 201-Created", context do db_name = context[:db_name] Couch.put("/#{db_name}") docs = create_docs(@doc_range) resp = Couch.post("/#{db_name}/_bulk_docs", body: %{docs: docs}) - msg = "Should return 202-Accepted" - assert resp.status_code == 202, msg + msg = "Should return 201-Created" + assert resp.status_code == 201, msg Couch.delete("/#{db_name}") end @@ -125,7 +126,7 @@ defmodule WithoutQuorumTest do end @tag :with_db_name - test "Attachments should return 202-Accepted", context do + test "Attachments should return 201-Created", context do db_name = context[:db_name] Couch.put("/#{db_name}") resp = Couch.post("/#{context[:db_name]}", body: %{:_id => "0"}) @@ -139,8 +140,8 @@ defmodule WithoutQuorumTest do headers: ["Content-Type": "text/plain;charset=utf-8"] ) - msg = "Should return 202-Accepted" - assert resp.status_code == 202, msg + msg = "Should return 201-Created" + assert resp.status_code == 201, msg rev = resp.body["rev"] resp = Couch.delete("/#{context[:db_name]}/0/foo.txt", query: %{:rev => rev})
