You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2018/01/26 20:39:07 UTC
[couchdb] 01/04: Allow tests to set config values dynamically
This is an automated email from the ASF dual-hosted git repository.
davisp pushed a commit to branch elixir-suite-davisp
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit e86d39227eb52bc76cb4d8b946361732eb44c9e9
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Fri Jan 26 14:31:47 2018 -0600
Allow tests to set config values dynamically
---
test/elixir/test/test_helper.exs | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/test/elixir/test/test_helper.exs b/test/elixir/test/test_helper.exs
index cb01fc2..9baf204 100644
--- a/test/elixir/test/test_helper.exs
+++ b/test/elixir/test/test_helper.exs
@@ -66,15 +66,7 @@ defmodule CouchTestCase do
end
def set_config({section, key, value}) do
- resp = Couch.get("/_membership")
- existing = Enum.map(resp.body["all_nodes"], fn node ->
- url = "/_node/#{node}/_config/#{section}/#{key}"
- headers = ["X-Couch-Persist": "false"]
- body = :jiffy.encode(value)
- resp = Couch.put(url, headers: headers, body: body)
- assert resp.status_code == 200
- {node, resp.body}
- end)
+ existing = set_config_raw(section, key, value)
on_exit(fn ->
Enum.each(existing, fn {node, prev_value} ->
if prev_value != "" do
@@ -93,6 +85,18 @@ defmodule CouchTestCase do
end)
end
+ def set_config_raw(section, key, value) do
+ resp = Couch.get("/_membership")
+ Enum.map(resp.body["all_nodes"], fn node ->
+ url = "/_node/#{node}/_config/#{section}/#{key}"
+ headers = ["X-Couch-Persist": "false"]
+ body = :jiffy.encode(value)
+ resp = Couch.put(url, headers: headers, body: body)
+ assert resp.status_code == 200
+ {node, resp.body}
+ end)
+ end
+
def create_db(db_name) do
resp = Couch.put("/#{db_name}")
assert resp.status_code == 201
--
To stop receiving notification emails like this one, please contact
davisp@apache.org.