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 2021/11/05 03:31:09 UTC

[couchdb] 01/04: Remove quorum tests

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

kocolosk pushed a commit to branch re-enable-most-elixir-tests-redux
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 8e11f778121504dcb48bb30e02b30640935c256b
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Thu Sep 24 13:36:10 2020 -0500

    Remove quorum tests
    
    Quorum is no longer a thing now that we rely on FoundationDB.
---
 Makefile                                         |  18 +--
 Makefile.win                                     |  16 +-
 test/elixir/test/cluster_with_quorum_test.exs    | 186 -----------------------
 test/elixir/test/cluster_without_quorum_test.exs | 185 ----------------------
 4 files changed, 3 insertions(+), 402 deletions(-)

diff --git a/Makefile b/Makefile
index 8400b70..652625d 100644
--- a/Makefile
+++ b/Makefile
@@ -243,7 +243,7 @@ elixir: elixir-init elixir-check-formatted elixir-credo devclean
 		--enable-erlang-views \
 		--locald-config test/elixir/test/config/test-config.ini \
 		--erlang-config rel/files/eunit.config \
-		--no-eval 'mix test --trace --exclude without_quorum_test --exclude with_quorum_test $(EXUNIT_OPTS)'
+		--no-eval 'mix test --trace $(EXUNIT_OPTS)'
 
 .PHONY: elixir-only
 elixir-only: devclean
@@ -253,27 +253,13 @@ elixir-only: devclean
 		--enable-erlang-views \
 		--locald-config test/elixir/test/config/test-config.ini \
 		--erlang-config rel/files/eunit.config \
-		--no-eval 'mix test --trace --exclude without_quorum_test --exclude with_quorum_test $(EXUNIT_OPTS)'
+		--no-eval 'mix test --trace $(EXUNIT_OPTS)'
 
 .PHONY: elixir-init
 elixir-init: MIX_ENV=test
 elixir-init: config.erl
 	@mix local.rebar --force && mix local.hex --force && mix deps.get
 
-.PHONY: elixir-cluster-without-quorum
-elixir-cluster-without-quorum: export MIX_ENV=integration
-elixir-cluster-without-quorum: elixir-init elixir-check-formatted elixir-credo devclean
-	@dev/run -n 3 -q -a adm:pass \
-		--degrade-cluster 2 \
-		--no-eval 'mix test --trace --only without_quorum_test $(EXUNIT_OPTS)'
-
-.PHONY: elixir-cluster-with-quorum
-elixir-cluster-with-quorum: export MIX_ENV=integration
-elixir-cluster-with-quorum: elixir-init elixir-check-formatted elixir-credo devclean
-	@dev/run -n 3 -q -a adm:pass \
-		--degrade-cluster 1 \
-		--no-eval 'mix test --trace --only with_quorum_test $(EXUNIT_OPTS)'
-
 .PHONY: elixir-suite
 elixir-suite: export MIX_ENV=integration
 elixir-suite: export COUCHDB_TEST_ADMIN_PARTY_OVERRIDE=1
diff --git a/Makefile.win b/Makefile.win
index a6966c1..ac8b187 100644
--- a/Makefile.win
+++ b/Makefile.win
@@ -207,27 +207,13 @@ elixir: export COUCHDB_TEST_ADMIN_PARTY_OVERRIDE=1
 elixir: elixir-init elixir-check-formatted elixir-credo devclean
 	@dev\run $(TEST_OPTS) -a adm:pass -n 1 --enable-erlang-views \
       --locald-config test/elixir/test/config/test-config.ini \
-      --no-eval 'mix test --trace --exclude without_quorum_test --exclude with_quorum_test $(EXUNIT_OPTS)'
+      --no-eval 'mix test --trace $(EXUNIT_OPTS)'
 
 .PHONY: elixir-init
 elixir-init: MIX_ENV=test
 elixir-init: config.erl
 	@mix local.rebar --force && mix local.hex --force && mix deps.get
 
-.PHONY: elixir-cluster-without-quorum
-elixir-cluster-without-quorum: export MIX_ENV=integration
-elixir-cluster-without-quorum: elixir-init elixir-check-formatted elixir-credo devclean
-	@dev\run -n 3 -q -a adm:pass \
-	    --degrade-cluster 2 \
-        --no-eval 'mix test --trace --only without_quorum_test $(EXUNIT_OPTS)'
-
-.PHONY: elixir-cluster-with-quorum
-elixir-cluster-with-quorum: export MIX_ENV=integration
-elixir-cluster-with-quorum: elixir-init elixir-check-formatted elixir-credo devclean
-	@dev\run -n 3 -q -a adm:pass \
-	    --degrade-cluster 1 \
-		--no-eval 'mix test --trace --only with_quorum_test $(EXUNIT_OPTS)'
-
 .PHONY: elixir-suite
 elixir-suite: export MIX_ENV=integration
 elixir-suite: export COUCHDB_TEST_ADMIN_PARTY_OVERRIDE=1
diff --git a/test/elixir/test/cluster_with_quorum_test.exs b/test/elixir/test/cluster_with_quorum_test.exs
deleted file mode 100644
index dc3d66b..0000000
--- a/test/elixir/test/cluster_with_quorum_test.exs
+++ /dev/null
@@ -1,186 +0,0 @@
-defmodule WithQuorumTest do
-  use CouchTestCase
-
-  @moduletag :with_quorum_test
-  @moduletag kind: :cluster
-
-  @moduledoc """
-  Test CouchDB API in a cluster without quorum.
-  """
-  @tag :with_db_name
-  test "Creating/Deleting DB should return 201-Created/202-Acepted", 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
-  end
-
-  @tag :with_db_name
-  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 201-Created"
-    assert resp.status_code in [201, 202], msg
-
-    resp = Couch.get("/#{context[:db_name]}/0")
-    rev = resp.body["_rev"]
-
-    resp =
-      Couch.put("/#{context[:db_name]}/0", body: %{:_id => "0", :_rev => rev, :a => 2})
-
-    msg = "Should return 201-Created"
-    assert resp.status_code in [201, 202], 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 200-OK"
-    assert resp.status_code == 200, msg
-
-    Couch.delete("/#{db_name}")
-  end
-
-  @tag :with_db_name
-  test "Creating-Updating/Deleting doc with overriden quorum should return 202-Acepted/200-OK",
-       context do
-    db_name = context[:db_name]
-    Couch.put("/#{db_name}")
-
-    resp =
-      Couch.post(
-        "/#{context[:db_name]}",
-        query: %{:w => 3},
-        body: %{:_id => "0", :a => 1}
-      )
-
-    msg = "Should return 202-Acepted"
-    assert resp.status_code == 202, msg
-
-    resp = Couch.get("/#{context[:db_name]}/0")
-    rev = resp.body["_rev"]
-
-    resp =
-      Couch.put(
-        "/#{context[:db_name]}/0",
-        query: %{:w => 3},
-        body: %{:_id => "0", :_rev => rev, :a => 2}
-      )
-
-    msg = "Should return 202-Acepted"
-    assert resp.status_code == 202, msg
-
-    resp = Couch.get("/#{context[:db_name]}/0")
-    rev = resp.body["_rev"]
-    resp = Couch.delete("/#{context[:db_name]}/0", query: %{:w => 1, :rev => rev})
-    msg = "Should return 200-Ok"
-    assert resp.status_code == 200, msg
-
-    Couch.delete("/#{db_name}")
-  end
-
-  @tag :with_db_name
-  test "Copy doc should return 201-Created", context do
-    db_name = context[:db_name]
-    Couch.put("/#{db_name}")
-
-    Couch.post(
-      "/#{context[:db_name]}",
-      body: %{:_id => "0", :a => 1}
-    )
-
-    headers = [Destination: "1"]
-    resp = Couch.request(:copy, "/#{context[:db_name]}/0", headers: headers)
-    msg = "Should return 201-Created"
-    assert resp.status_code in [201, 202], msg
-    Couch.delete("/#{db_name}")
-  end
-
-  @doc_range 1..5
-
-  @tag :with_db_name
-  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 201-Created"
-    assert resp.status_code in [201, 202], msg
-
-    Couch.delete("/#{db_name}")
-  end
-
-  @tag :with_db_name
-  test "Bulk docs overriden quorum should return 202-Acepted", 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"
-    assert resp.status_code == 202, msg
-
-    Couch.delete("/#{db_name}")
-  end
-
-  @tag :with_db_name
-  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"})
-    rev = resp.body["rev"]
-
-    resp =
-      Couch.put(
-        "/#{context[:db_name]}/0/foo.txt",
-        query: %{:rev => rev},
-        body: "This is a no bas64 encoded text",
-        headers: ["Content-Type": "text/plain;charset=utf-8"]
-      )
-
-    msg = "Should return 201-Created"
-    assert resp.status_code in [201, 202], msg
-
-    rev = resp.body["rev"]
-    resp = Couch.delete("/#{context[:db_name]}/0/foo.txt", query: %{:rev => rev})
-    msg = "Should return 200-Ok"
-    assert resp.status_code == 200, msg
-
-    Couch.delete("/#{db_name}")
-  end
-
-  @tag :with_db_name
-  test "Attachments overriden quorum should return 202-Acepted", context do
-    db_name = context[:db_name]
-    Couch.put("/#{db_name}")
-    resp = Couch.post("/#{context[:db_name]}", body: %{:_id => "0"})
-    rev = resp.body["rev"]
-
-    resp =
-      Couch.put(
-        "/#{context[:db_name]}/0/foo.txt",
-        query: %{:rev => rev, :w => 3},
-        body: "This is a no bas64 encoded text",
-        headers: ["Content-Type": "text/plain;charset=utf-8"]
-      )
-
-    msg = "Should return 202-Acepted"
-    assert resp.status_code == 202, msg
-
-    rev = resp.body["rev"]
-
-    resp =
-      Couch.delete(
-        "/#{context[:db_name]}/0/foo.txt",
-        query: %{:rev => rev, :w => 3}
-      )
-
-    msg = "Should return 200-Ok"
-    assert resp.status_code == 200, msg
-
-    Couch.delete("/#{db_name}")
-  end
-end
diff --git a/test/elixir/test/cluster_without_quorum_test.exs b/test/elixir/test/cluster_without_quorum_test.exs
deleted file mode 100644
index 63371f1..0000000
--- a/test/elixir/test/cluster_without_quorum_test.exs
+++ /dev/null
@@ -1,185 +0,0 @@
-defmodule WithoutQuorumTest do
-  use CouchTestCase
-
-  @moduletag :without_quorum_test
-  @moduletag kind: :degraded_cluster
-
-  @moduledoc """
-  Test CouchDB API in a cluster without quorum.
-  """
-  @tag :with_db_name
-  test "Creating/Deleting DB should return 202-Acepted", context do
-    db_name = context[:db_name]
-    resp = Couch.put("/#{db_name}")
-    msg = "Should return 202-Acepted"
-    assert resp.status_code == 202, msg
-    resp = Couch.delete("/#{db_name}")
-    assert resp.status_code == 202, msg
-  end
-
-  @tag :with_db_name
-  test "Creating/Updating/Deleting doc should return 202-Acepted", 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-Acepted"
-    assert resp.status_code == 202, msg
-
-    resp = Couch.get("/#{context[:db_name]}/0")
-    rev = resp.body["_rev"]
-
-    resp =
-      Couch.put("/#{context[:db_name]}/0", body: %{:_id => "0", :_rev => rev, :a => 2})
-
-    msg = "Should return 202-Acepted"
-    assert resp.status_code == 202, 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-Acepted"
-    assert resp.status_code == 202, msg
-
-    Couch.delete("/#{db_name}")
-  end
-
-  @tag :with_db_name
-  test "Creating-Updating/Deleting doc with overriden quorum should return 201-Created/200-OK",
-       context do
-    db_name = context[:db_name]
-    Couch.put("/#{db_name}")
-
-    resp =
-      Couch.post(
-        "/#{context[:db_name]}",
-        query: %{:w => 1},
-        body: %{:_id => "0", :a => 1}
-      )
-
-    msg = "Should return 201-Created"
-    assert resp.status_code in [201, 202], msg
-
-    resp = Couch.get("/#{context[:db_name]}/0")
-    rev = resp.body["_rev"]
-
-    resp =
-      Couch.put(
-        "/#{context[:db_name]}/0",
-        query: %{:w => 1},
-        body: %{:_id => "0", :_rev => rev, :a => 2}
-      )
-
-    msg = "Should return 201-Created"
-    assert resp.status_code in [201, 202], msg
-
-    resp = Couch.get("/#{context[:db_name]}/0")
-    rev = resp.body["_rev"]
-    resp = Couch.delete("/#{context[:db_name]}/0", query: %{:w => 1, :rev => rev})
-    msg = "Should return 200-Ok"
-    assert resp.status_code == 200, msg
-
-    Couch.delete("/#{db_name}")
-  end
-
-  @tag :with_db_name
-  test "Copy doc should return 202-Acepted", context do
-    db_name = context[:db_name]
-    Couch.put("/#{db_name}")
-
-    Couch.post(
-      "/#{context[:db_name]}",
-      body: %{:_id => "0", :a => 1}
-    )
-
-    headers = [Destination: "1"]
-    resp = Couch.request(:copy, "/#{context[:db_name]}/0", headers: headers)
-    msg = "Should return 202-Acepted"
-    assert resp.status_code == 202, msg
-    Couch.delete("/#{db_name}")
-  end
-
-  @doc_range 1..5
-
-  @tag :with_db_name
-  test "Bulk docs should return 202-Acepted", 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-Acepted"
-    assert resp.status_code == 202, msg
-
-    Couch.delete("/#{db_name}")
-  end
-
-  @tag :with_db_name
-  test "Bulk docs overriden quorum 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", query: %{:w => 1}, body: %{docs: docs})
-    msg = "Should return 201-Created"
-    assert resp.status_code in [201, 202], msg
-
-    Couch.delete("/#{db_name}")
-  end
-
-  @tag :with_db_name
-  test "Attachments should return 202-Acepted", context do
-    db_name = context[:db_name]
-    Couch.put("/#{db_name}")
-    resp = Couch.post("/#{context[:db_name]}", body: %{:_id => "0"})
-    rev = resp.body["rev"]
-
-    resp =
-      Couch.put(
-        "/#{context[:db_name]}/0/foo.txt",
-        query: %{:rev => rev},
-        body: "This is a no bas64 encoded text",
-        headers: ["Content-Type": "text/plain;charset=utf-8"]
-      )
-
-    msg = "Should return 202-Acepted"
-    assert resp.status_code == 202, msg
-
-    rev = resp.body["rev"]
-    resp = Couch.delete("/#{context[:db_name]}/0/foo.txt", query: %{:rev => rev})
-    msg = "Should return 200-Ok"
-    assert resp.status_code == 200, msg
-
-    Couch.delete("/#{db_name}")
-  end
-
-  @tag :with_db_name
-  test "Attachments overriden quorum should return 201-Created", context do
-    db_name = context[:db_name]
-    Couch.put("/#{db_name}")
-    resp = Couch.post("/#{context[:db_name]}", body: %{:_id => "0"})
-    rev = resp.body["rev"]
-
-    resp =
-      Couch.put(
-        "/#{context[:db_name]}/0/foo.txt",
-        query: %{:rev => rev, :w => 1},
-        body: "This is a no bas64 encoded text",
-        headers: ["Content-Type": "text/plain;charset=utf-8"]
-      )
-
-    msg = "Should return 201-Created"
-    assert resp.status_code in [201, 202], msg
-
-    rev = resp.body["rev"]
-
-    resp =
-      Couch.delete(
-        "/#{context[:db_name]}/0/foo.txt",
-        query: %{:rev => rev, :w => 1}
-      )
-
-    msg = "Should return 200-Ok"
-    assert resp.status_code == 200, msg
-
-    Couch.delete("/#{db_name}")
-  end
-end