[GitHub] wohali commented on issue #1231: Replace resource expensive bcrypt test with shorter version

2018-03-23 Thread GitBox
wohali commented on issue #1231: Replace resource expensive bcrypt test with 
shorter version
URL: https://github.com/apache/couchdb/pull/1231#issuecomment-375840362
 
 
   @eiri we got a random failure in Jenkins related to encryption after this 
hit master, can you investigate please?
   
   
https://builds.apache.org/blue/organizations/jenkins/CouchDB/detail/master/223/pipeline
   
   Logs at 
https://couchdb-vm2.apache.org/ci_errorlogs/jenkins-couchdb-223-2018-03-23T23:15:34.663810/couchlog.tar.gz
   
   ```
   test/javascript/tests/users_db_security.js 
   Error: undefined
   Trace back (most recent call first):
   
 52: test/javascript/test_setup.js
 T((void 0))
 35: test/javascript/tests/users_db_security.js
 ("jchris1")
 39: test/javascript/tests/users_db_security.js
 ([object Object],"org.couchdb.user:fdmanana","jchris1")
168: test/javascript/tests/users_db_security.js
 ("pbkdf2",(function (derived_key) {TEquals(40, derived_key.length, "de
413: test/javascript/tests/users_db_security.js
 ()
395: test/javascript/couch_test_runner.js
 run_on_modified_server([object Array],(function () {try {testFun(schem
411: test/javascript/tests/users_db_security.js
 ("pbkdf2",0,[object Array])
399: test/javascript/tests/users_db_security.js
 ()
 37: test/javascript/cli_runner.js
 runTest()
 48: test/javascript/cli_runner.js
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] wohali commented on issue #1231: Remove resource expensive bcrypt test

2018-03-23 Thread GitBox
wohali commented on issue #1231: Remove resource expensive bcrypt test
URL: https://github.com/apache/couchdb/pull/1231#issuecomment-375759036
 
 
   Good catch! +1 and go for it.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[Jenkins] FAILURE: CouchDB » master #222

2018-03-23 Thread Apache Jenkins Server
Boo, we failed. https://builds.apache.org/job/CouchDB/job/master/222/

[GitHub] eiri closed pull request #1231: Replace resource expensive bcrypt test with shorter version

2018-03-23 Thread GitBox
eiri closed pull request #1231: Replace resource expensive bcrypt test with 
shorter version
URL: https://github.com/apache/couchdb/pull/1231
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/couch/test/couch_passwords_tests.erl 
b/src/couch/test/couch_passwords_tests.erl
index c624dba5b0..a56627361f 100644
--- a/src/couch/test/couch_passwords_tests.erl
+++ b/src/couch/test/couch_passwords_tests.erl
@@ -53,24 +53,24 @@ pbkdf2_test_()->
)}}]}.
 
 
-
-setup() ->
-test_util:start(?MODULE, [bcrypt]).
-
-teardown(Ctx)->
-test_util:stop(Ctx).
-
 bcrypt_test_() ->
 {
 "Bcrypt",
 {
-foreach,
-fun setup/0, fun teardown/1,
+setup,
+fun() ->
+test_util:start_applications([bcrypt])
+end,
+fun test_util:stop_applications/1,
 [
-{timeout, 1, fun bcrypt_logRounds_4/0},
-{timeout, 5, fun bcrypt_logRounds_12/0},
-{timeout, 180, fun bcrypt_logRounds_18/0},
-{timeout, 5, fun bcrypt_null_byte/0}
+{"Log rounds: 4",
+{timeout, 1, fun bcrypt_logRounds_4/0}},
+{"Log rounds: 5",
+{timeout, 1, fun bcrypt_logRounds_5/0}},
+{"Log rounds: 12",
+{timeout, 5, fun bcrypt_logRounds_12/0}},
+{"Null byte",
+{timeout, 5, fun bcrypt_null_byte/0}}
 
 ]
 }
@@ -79,16 +79,16 @@ bcrypt_test_() ->
 bcrypt_logRounds_4() ->
 bcrypt_assert_equal(<<"password">>, 4).
 
+bcrypt_logRounds_5() ->
+bcrypt_assert_equal(<<"password">>, 5).
+
 bcrypt_logRounds_12() ->
 bcrypt_assert_equal(<<"password">>, 12).
 
-bcrypt_logRounds_18() ->
-bcrypt_assert_equal(<<"password">>, 18).
-
 bcrypt_null_byte() ->
 bcrypt_assert_equal(<<"passw\0rd">>, 12).
 
 bcrypt_assert_equal(Password, Rounds) when is_integer(Rounds) ->
 HashPass = couch_passwords:bcrypt(Password, Rounds),
 ReHashPass = couch_passwords:bcrypt(Password, HashPass),
-?_assertEqual(HashPass, ReHashPass).
+?assertEqual(HashPass, ReHashPass).


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] eiri closed pull request #1230: Validate password_scheme in user doc

2018-03-23 Thread GitBox
eiri closed pull request #1230: Validate password_scheme in user doc
URL: https://github.com/apache/couchdb/pull/1230
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/couch/include/couch_js_functions.hrl 
b/src/couch/include/couch_js_functions.hrl
index 6851718ff2..d969416d67 100644
--- a/src/couch/include/couch_js_functions.hrl
+++ b/src/couch/include/couch_js_functions.hrl
@@ -64,6 +64,15 @@
 });
 }
 
+var available_schemes = [\"simple\", \"pbkdf2\", \"bcrypt\"];
+if (newDoc.password_scheme
+&& available_schemes.indexOf(newDoc.password_scheme) == -1) {
+throw({
+forbidden: 'Password scheme `' + newDoc.password_scheme
++ '` not supported.'
+});
+}
+
 if (newDoc.password_scheme === \"pbkdf2\") {
 if (typeof(newDoc.iterations) !== \"number\") {
throw({forbidden: \"iterations must be a number.\"});


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] eiri opened a new issue #1232: Extend tests utility belt

2018-03-23 Thread GitBox
eiri opened a new issue #1232: Extend tests utility belt
URL: https://github.com/apache/couchdb/issues/1232
 
 
   It's be nice to have some standard test wrapper with 'retry until' or 'pass 
if any of N' functionality to deal with things like:
   
   ```
   Compact after lowering attachment size limit couchdb_attachments_tests:544: 
should_compact_after_lowering_attachment_size_limit...*failed*
   
   in function couchdb_attachments_tests:wait_compaction/3 
(test/couchdb_attachments_tests.erl, line 586)
   in call from couchdb_attachments_tests:compact_db/1 
(test/couchdb_attachments_tests.erl, line 573)
   in call from 
couchdb_attachments_tests:'-should_compact_after_lowering_attachment_size_limit/1-fun-1-'/1
 (test/couchdb_attachments_tests.erl, line 550)
   
   **error:{assertion_failed,[{module,couchdb_attachments_tests}, {line,573},
   {reason,"Timeout waiting for database database compaction"}]}
 output:<<"">>
   ```
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] wohali opened a new issue #1233: Unstable compaction test; failed due to timeout

2018-03-23 Thread GitBox
wohali opened a new issue #1233: Unstable compaction test; failed due to timeout
URL: https://github.com/apache/couchdb/issues/1233
 
 
   Jenkins failure, https://builds.apache.org/job/CouchDB/job/master/222/
   
   ```
 Compact after lowering attachment size limit
   couchdb_attachments_tests:544: 
should_compact_after_lowering_attachment_size_limit...*failed*
   in function couchdb_attachments_tests:wait_compaction/3 
(test/couchdb_attachments_tests.erl, line 586)
   in call from couchdb_attachments_tests:compact_db/1 
(test/couchdb_attachments_tests.erl, line 573)
   in call from 
couchdb_attachments_tests:'-should_compact_after_lowering_attachment_size_limit/1-fun-1-'/1
 (test/couchdb_attachments_tests.erl, line 550)
   **error:{assertion_failed,[{module,couchdb_attachments_tests},
  {line,573},
  {reason,"Timeout waiting for database database 
compaction"}]}
 output:<<"">>
   ```
   
   Also, "database database compaction"? Heh.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] eiri commented on issue #1233: Unstable compaction test; failed due to timeout

2018-03-23 Thread GitBox
eiri commented on issue #1233: Unstable compaction test; failed due to timeout
URL: https://github.com/apache/couchdb/issues/1233#issuecomment-375797054
 
 
   For reference apache/couchdb#1232


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] nickva opened a new pull request #1234: Fix 413 response handling and re-enable related couch replicator test

2018-03-23 Thread GitBox
nickva opened a new pull request #1234: Fix 413 response handling and re-enable 
related couch replicator test
URL: https://github.com/apache/couchdb/pull/1234
 
 
   Previously, when the server decided too much data sent with the client's
   request, it would immediately send a 413 response and close the socket. The
   client side kept sending incoming data as the socket was closed with unread
   data in it. When this happens the connection was reset instead of going 
through
   a regular close sequence. The client, specifically the replicator client,
   detected the connection reset event before it had a chance to process the 413
   response.
   
   Also re-enable the previously disabled `replicate_one_with_attachment` test.
   
   To test run this for a while:
   
   ```
   make soak-eunit apps=couch_replicator 
suites=couch_replicator_small_max_request_size_target
   ```
   
   
   - [x] Code is written and works correctly;
   - [x] Changes are covered by tests;
   - [ ] Documentation reflects the changes;
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] rnewson commented on issue #1234: Fix 413 response handling and re-enable related couch replicator test

2018-03-23 Thread GitBox
rnewson commented on issue #1234: Fix 413 response handling and re-enable 
related couch replicator test
URL: https://github.com/apache/couchdb/pull/1234#issuecomment-375818638
 
 
   You described the previous behaviour in the pr description but not the new 
behaviour. 
   
   Sent from my iPhone
   
   > On 23 Mar 2018, at 22:28, Nick Vatamaniuc  wrote:
   > 
   > Previously, when the server decided too much data sent with the client's
   > request, it would immediately send a 413 response and close the socket. The
   > client side kept sending incoming data as the socket was closed with unread
   > data in it. When this happens the connection was reset instead of going 
through
   > a regular close sequence. The client, specifically the replicator client,
   > detected the connection reset event before it had a chance to process the 
413
   > response.
   > 
   > Also re-enable the previously disabled replicate_one_with_attachment test.
   > 
   > To test run this for a while:
   > 
   > make soak-eunit apps=couch_replicator 
suites=couch_replicator_small_max_request_size_target
   >  Code is written and works correctly;
   >  Changes are covered by tests;
   >  Documentation reflects the changes;
   > You can view, comment on, or merge this pull request online at:
   > 
   >   https://github.com/apache/couchdb/pull/1234
   > 
   > Commit Summary
   > 
   > Revert "Revert "re-enable "flaky" test in quest to nail down #745""
   > Improve 413 response handling
   > File Changes
   > 
   > M src/couch/src/couch_httpd.erl (11)
   > M 
src/couch_replicator/test/couch_replicator_small_max_request_size_target.erl
 (28)
   > Patch Links:
   > 
   > https://github.com/apache/couchdb/pull/1234.patch
   > https://github.com/apache/couchdb/pull/1234.diff
   > —
   > You are receiving this because you are subscribed to this thread.
   > Reply to this email directly, view it on GitHub, or mute the thread.
   > 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[Jenkins] FAILURE: CouchDB » master #223

2018-03-23 Thread Apache Jenkins Server
Boo, we failed. https://builds.apache.org/job/CouchDB/job/master/223/

[GitHub] iilyak commented on issue #1147: Add _all_docs_view_query endpoint

2018-03-23 Thread GitBox
iilyak commented on issue #1147: Add _all_docs_view_query endpoint
URL: https://github.com/apache/couchdb/pull/1147#issuecomment-375717948
 
 
   > @iilyak This got superseded by apache/couchdb#1222 I guess?
   
   correct
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] iilyak closed pull request #1147: Add _all_docs_view_query endpoint

2018-03-23 Thread GitBox
iilyak closed pull request #1147: Add _all_docs_view_query endpoint
URL: https://github.com/apache/couchdb/pull/1147
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/chttpd/src/chttpd_db.erl b/src/chttpd/src/chttpd_db.erl
index de5c79c66e..d1dd026b19 100644
--- a/src/chttpd/src/chttpd_db.erl
+++ b/src/chttpd/src/chttpd_db.erl
@@ -533,6 +533,18 @@ db_req(#httpd{method='POST',path_parts=[_,OP]}=Req, Db) 
when ?IS_ALL_DOCS(OP) ->
 db_req(#httpd{path_parts=[_,OP]}=Req, _Db) when ?IS_ALL_DOCS(OP) ->
 send_method_not_allowed(Req, "GET,HEAD,POST");
 
+db_req(#httpd{method='POST', path_parts=[_, <<"_all_docs_view_query">>]}=Req, 
Db) ->
+Props = chttpd:json_body_obj(Req),
+case couch_mrview_util:get_view_queries(Props) of
+Queries when Queries =/= undefined ->
+multi_all_docs_view(Req, Db, <<"_all_docs">>, Queries);
+undefined ->
+throw({bad_request, <<"POST body must include `queries` 
parameter.">>})
+end;
+
+db_req(#httpd{path_parts=[_, <<"_all_docs_view_quiery">>]}=Req, _Db) ->
+send_method_not_allowed(Req, "POST");
+
 db_req(#httpd{method='POST',path_parts=[_,<<"_missing_revs">>]}=Req, Db) ->
 chttpd:validate_ctype(Req, "application/json"),
 {JsonDocIdRevs} = chttpd:json_body_obj(Req),
@@ -636,6 +648,28 @@ db_req(#httpd{path_parts=[_, DocId]}=Req, Db) ->
 db_req(#httpd{path_parts=[_, DocId | FileNameParts]}=Req, Db) ->
 db_attachment_req(Req, Db, DocId, FileNameParts).
 
+multi_all_docs_view(Req, Db, OP, Queries) ->
+Args0 = couch_mrview_http:parse_params(Req, undefined),
+Args1 = Args0#mrargs{view_type=map},
+ArgQueries = lists:map(fun({Query}) ->
+QueryArg1 = couch_mrview_http:parse_params(Query, undefined,
+Args1, [decoded]),
+QueryArgs2 = couch_mrview_util:validate_args(QueryArg1),
+set_namespace(OP, QueryArgs2)
+end, Queries),
+Options = [{user_ctx, Req#httpd.user_ctx}],
+VAcc0 = #vacc{db=Db, req=Req, prepend="\r\n"},
+FirstChunk = "{\"results\":[",
+{ok, Resp0} = chttpd:start_delayed_json_response(VAcc0#vacc.req, 200, [], 
FirstChunk),
+VAcc1 = VAcc0#vacc{resp=Resp0},
+VAcc2 = lists:foldl(fun(Args, Acc0) ->
+{ok, Acc1} = fabric:all_docs(Db, Options,
+fun couch_mrview_http:view_cb/2, Acc0, Args),
+Acc1
+end, VAcc1, ArgQueries),
+{ok, Resp1} = chttpd:send_delayed_chunk(VAcc2#vacc.resp, "\r\n]}"),
+chttpd:end_delayed_json_response(Resp1).
+
 all_docs_view(Req, Db, Keys, OP) ->
 Args0 = couch_mrview_http:parse_params(Req, Keys),
 Args1 = Args0#mrargs{view_type=map},
diff --git a/src/chttpd/test/chttpd_db_test.erl 
b/src/chttpd/test/chttpd_db_test.erl
index 2071ca5025..08d9eaf0d8 100644
--- a/src/chttpd/test/chttpd_db_test.erl
+++ b/src/chttpd/test/chttpd_db_test.erl
@@ -70,6 +70,9 @@ all_test_() ->
 fun should_return_409_for_put_att_nonexistent_rev/1,
 fun should_return_update_seq_when_set_on_all_docs/1,
 fun should_not_return_update_seq_when_unset_on_all_docs/1,
+fun should_succeed_on_all_docs_with_queries_keys/1,
+fun should_succeed_on_all_docs_with_queries_limit_skip/1,
+fun should_succeed_on_all_docs_with_multiple_queries/1,
 fun should_return_correct_id_on_doc_copy/1
 ]
 }
@@ -222,6 +225,52 @@ should_not_return_update_seq_when_unset_on_all_docs(Url) ->
 couch_util:get_value(<<"offset">>, ResultJson))
 end).
 
+should_succeed_on_all_docs_with_queries_keys(Url) ->
+?_test(begin
+[create_doc(Url, "testdoc" ++ ?i2l(I)) || I <- lists:seq(1, 10)],
+QueryDoc = "{\"queries\": [{\"keys\": [ \"testdoc3\", 
\"testdoc8\"]}]}",
+{ok, RC, _, RespBody} = test_request:post(Url ++ 
"/_all_docs_view_query/",
+[?CONTENT_JSON, ?AUTH], QueryDoc),
+?assertEqual(200, RC),
+{ResultJson} = ?JSON_DECODE(RespBody),
+ResultJsonBody = couch_util:get_value(<<"results">>, ResultJson),
+{InnerJson} = lists:nth(1, ResultJsonBody),
+?assertEqual(2, length(couch_util:get_value(<<"rows">>, InnerJson)))
+end).
+
+
+should_succeed_on_all_docs_with_queries_limit_skip(Url) ->
+?_test(begin
+[create_doc(Url, "testdoc" ++ ?i2l(I)) || I <- lists:seq(1, 10)],
+QueryDoc = "{\"queries\": [{\"limit\": 5, \"skip\": 2}]}",
+{ok, RC, _, RespBody} = test_request:post(Url ++ 
"/_all_docs_view_query/",
+[?CONTENT_JSON, ?AUTH], QueryDoc),
+?assertEqual(200, RC),
+{ResultJson} = ?JSON_DECODE(RespBody),
+ResultJsonBody = couch_util:get_value(<<"results">>, ResultJson),
+{InnerJson} = 

[GitHub] eiri commented on issue #1231: Remove resource expensive bcrypt test

2018-03-23 Thread GitBox
eiri commented on issue #1231: Remove resource expensive bcrypt test
URL: https://github.com/apache/couchdb/pull/1231#issuecomment-375700690
 
 
   @wohali I've added `bcrypt_logRounds_5` and (surprise!) found that the tests 
were actually  broken - generators been returning test objects instead of 
running assertions, infamous and hugely common error.
   
   I fixed that, simplified setup (we've been starting and stopping bunch of 
unused apps and for some reason did it for each test individually) and added 
the tests descriptions. How does it look for you now?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services