Github user kxepal commented on a diff in the pull request:
https://github.com/apache/couchdb-chttpd/pull/9#discussion_r20599102
--- Diff: test/chttpd_db_test.erl ---
@@ -0,0 +1,58 @@
+% Licensed under the Apache License, Version 2.0 (the "License"); you may
not
+% use this file except in compliance with the License. You may obtain a
copy of
+% the License at
+%
+% http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations
under
+% the License.
+
+-module(chttpd_db_test).
+
+-include_lib("couch/include/couch_eunit.hrl").
+-include_lib("couch/include/couch_db.hrl").
+
+-define(TIMEOUT, 1000).
+
+setup() ->
+ Cmd = "../../../dev/run",
+ TmpDb = ?b2l(?tempdb()),
+ Config = filename:join([?BUILDDIR(), "dev", "lib", "node1", "etc",
"default.ini"]),
+ {ok, _Pid} = config:start_link([Config]),
+ Url = lists:concat(["http://", config:get("httpd", "bind_address"),
":", config:get("chttpd", "port"), "/", TmpDb]),
+ {erlang:open_port({spawn, Cmd}, [exit_status]), Url}.
+
+teardown({Port, Url}) ->
+ {ok, _Code, _Headers, _Body} = test_request:delete(Url),
+ config:stop(),
+ port_close(Port),
+ ok.
+
+all_test_() ->
+ {
+ foreach,
+ fun setup/0, fun teardown/1,
+ [
+ fun should_return_ok_true_on_bulk_update/1
+ ]
+ }.
+
+
+should_return_ok_true_on_bulk_update({_Port, Url}) ->
+ ?_assertEqual(true,
+ begin
+ {ok, _, _, _} = test_request:delete(Url),
+ {ok, _, _, _} = test_request:put(Url, ""),
+ {ok, _, _, Body} = test_request:put(Url ++ "/testdoc",
+ [{"Content-Type", "application/json"}], "{}"),
+ Json = jiffy:decode(Body),
+ Ref = proplists:get_value(<<"rev">>, element(1, Json)),
+ NewDoc = "{\"docs\": [{\"_rev\": \"" ++ ?b2l(Ref) ++ "\",
\"_id\": \"testdoc\"}]}",
+ {ok, _, _, ResultBody} = test_request:post(Url ++
"/_bulk_docs/",
+ [{"Content-Type", "application/json"}], NewDoc),
+ ?debugFmt("~s", [?b2l(ResultBody)]),
+ string:str(?b2l(ResultBody), "\"ok\":true") > 0
--- End diff --
Sorry, miss it. I believe that the failure is related to how you run the
server.
AFAIK, the JS tests are don't test cluster interface and changing this will
lead to fixing JS test suite too.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---