Github user iilyak commented on a diff in the pull request:

    https://github.com/apache/couchdb-chttpd/pull/154#discussion_r99669106
  
    --- Diff: test/chttpd_open_revs_error_test.erl ---
    @@ -0,0 +1,107 @@
    +% 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_open_revs_error_test).
    +
    +-include_lib("couch/include/couch_eunit.hrl").
    +-include_lib("couch/include/couch_db.hrl").
    +
    +-define(USER, "chttpd_db_test_admin").
    +-define(PASS, "pass").
    +-define(AUTH, {basic_auth, {?USER, ?PASS}}).
    +-define(CONTENT_JSON, {"Content-Type", "application/json"}).
    +-define(CONTENT_MULTI_FORM, {"Content-Type",
    +    "multipart/form-data;boundary=\"bound\""}).
    +
    +setup() ->
    +    ok = config:set("admins", ?USER, ?PASS, _Persist=false),
    +    TmpDb = ?tempdb(),
    +    Addr = config:get("chttpd", "bind_address", "127.0.0.1"),
    +    Port = mochiweb_socket_server:get(chttpd, port),
    +    Url = lists:concat(["http://";, Addr, ":", Port, "/", ?b2l(TmpDb)]),
    +    create_db(Url),
    +    Url.
    +
    +teardown(Url) ->
    +    delete_db(Url),
    +    ok = config:delete("admins", ?USER, _Persist=false).
    +
    +create_db(Url) ->
    +    {ok, Status, _, _} = test_request:put(Url, [?CONTENT_JSON, ?AUTH], 
"{}"),
    +    ?assert(Status =:= 201 orelse Status =:= 202).
    +
    +
    +create_doc(Url, Id) ->
    +    test_request:put(Url ++ "/" ++ Id,
    +        [?CONTENT_JSON, ?AUTH], "{\"mr\": \"rockoartischocko\"}").
    +
    +delete_db(Url) ->
    +    {ok, 200, _, _} = test_request:delete(Url, [?AUTH]).
    +
    +open_revs_error_test_() ->
    +    {
    +        "open revs error tests",
    +        {
    +            setup,
    +            fun chttpd_test_util:start_couch/0, fun 
chttpd_test_util:stop_couch/1,
    +            {
    +                foreach,
    +                fun setup/0, fun teardown/1,
    +                [
    +                    fun should_return_503_error_for_open_revs_get/1,
    +                    fun should_return_503_error_for_open_revs_post_form/1
    +                ]
    +            }
    +        }
    +    }.
    +
    +should_return_503_error_for_open_revs_get(Url) ->
    +    {ok, _, _, Body} = create_doc(Url, "testdoc"),
    +    {Json} = ?JSON_DECODE(Body),
    +    Ref = couch_util:get_value(<<"rev">>, Json, undefined),
    +    mock(fabric),
    +    mock_open_revs({error, all_workers_died}),
    +    ok, Code, _, _} = test_request:get(Url ++
    --- End diff --
    
    @tonysun83: There is a syntax error here (missing `{`)


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to