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 2020/09/16 15:35:18 UTC

[couchdb] 01/01: Merge branch 'master' into prototype/fdb-layer

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

davisp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit acdcc906c2a571697ae141b9b06a2353c92c22b6
Merge: ae85819 69f6b86
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Wed Sep 16 10:19:36 2020 -0500

    Merge branch 'master' into prototype/fdb-layer

 .credo.exs                                         |   7 +-
 .gitignore                                         |   3 +
 INSTALL.Unix.md                                    |   2 +-
 Makefile                                           |  27 +-
 Makefile.win                                       |  14 +-
 README.rst                                         |   8 +-
 build-aux/Jenkinsfile.full                         |  49 +-
 dev/run                                            |  27 ++
 mix.exs                                            |   4 +-
 mix.lock                                           |   4 +-
 rebar.config.script                                |  23 +-
 rel/files/couchdb.cmd.in                           |   2 +-
 rel/overlay/bin/remsh                              |  21 +-
 rel/overlay/etc/default.ini                        |  27 +-
 rel/reltool.config                                 |   4 +-
 src/chttpd/src/chttpd_auth.erl                     |  23 +-
 src/chttpd/test/eunit/chttpd_auth_tests.erl        | 129 ++++++
 src/couch/include/couch_eunit.hrl                  |   5 +
 src/couch/priv/couch_js/60/http.cpp                | 214 ++++-----
 src/couch/priv/couch_js/60/main.cpp                |  69 ++-
 src/couch/priv/couch_js/60/utf8.cpp                | 301 ------------
 src/couch/priv/couch_js/60/util.cpp                | 196 ++++----
 src/couch/priv/couch_js/60/util.h                  |   4 +-
 src/couch/priv/couch_js/68/help.h                  |  86 ++++
 src/couch/priv/couch_js/{60 => 68}/http.cpp        | 215 ++++-----
 src/couch/priv/couch_js/{60/utf8.h => 68/http.h}   |  16 +-
 src/couch/priv/couch_js/{60 => 68}/main.cpp        | 139 ++++--
 src/couch/priv/couch_js/{60 => 68}/util.cpp        | 205 +++++----
 src/couch/priv/couch_js/{60 => 68}/util.h          |   5 +-
 src/couch/rebar.config.script                      |  72 +--
 src/couch/src/couch.app.src                        |   1 -
 src/couch/src/couch.erl                            |   1 -
 src/couch/src/couch_httpd_auth.erl                 |  32 +-
 src/couch/src/couch_query_servers.erl              | 107 ++++-
 src/couch/src/couch_server.erl                     |   5 +-
 src/couch/test/eunit/couch_js_tests.erl            | 139 +++++-
 .../test/eunit/couchdb_cookie_domain_tests.erl     |  13 +-
 src/couch_mrview/src/couch_mrview_index.erl        |  11 +-
 src/fabric/src/fabric_rpc.erl                      |   5 +-
 src/fabric/test/eunit/fabric_rpc_tests.erl         | 181 ++++++++
 src/jwtf/.gitignore                                |   4 +
 src/jwtf/LICENSE                                   | 176 +++++++
 src/jwtf/README.md                                 |  18 +
 src/jwtf/rebar.config                              |   2 +
 src/jwtf/src/jwtf.app.src                          |  32 ++
 src/jwtf/src/jwtf.erl                              | 353 ++++++++++++++
 src/jwtf/src/jwtf_app.erl                          |  28 ++
 src/jwtf/src/jwtf_keystore.erl                     | 161 +++++++
 src/jwtf/src/jwtf_sup.erl                          |  38 ++
 src/jwtf/test/jwtf_keystore_tests.erl              |  57 +++
 src/jwtf/test/jwtf_tests.erl                       | 317 +++++++++++++
 src/mango/README.md                                | 328 +++++++++----
 src/mango/TODO.md                                  |  19 +-
 src/mango/rebar.config                             |   2 +
 src/mango/src/mango_json_bookmark.erl              |   2 +-
 src/mango/src/mango_selector.erl                   |   4 +-
 src/mango/test/21-empty-selector-tests.py          |  24 +-
 src/mango/test/README.md                           |  17 +-
 src/mango/test/mango.py                            |   8 +
 src/mango/test/user_docs.py                        |   4 +
 src/mem3/src/mem3_reshard_dbdoc.erl                |   3 +-
 src/mem3/src/mem3_rpc.erl                          |   2 +-
 src/mem3/src/mem3_shards.erl                       |  22 +-
 src/mem3/src/mem3_util.erl                         |  86 +++-
 src/setup/src/setup.erl                            |   2 +-
 support/build_js.escript                           |   6 +
 test/elixir/README.md                              |  31 +-
 test/elixir/lib/couch.ex                           |   4 +-
 test/elixir/lib/couch/db_test.ex                   |  30 +-
 test/elixir/test/config/test-config.ini            |   2 +
 test/elixir/test/cookie_auth_test.exs              |  15 +-
 test/elixir/test/design_docs_query_test.exs        | 273 +++++++++++
 test/elixir/test/design_docs_test.exs              | 507 ++++++++++++++++++---
 test/elixir/test/design_options_test.exs           |  74 +++
 test/elixir/test/design_paths_test.exs             |  76 +++
 test/elixir/test/http_test.exs                     |  81 ++++
 test/elixir/test/jsonp_test.exs                    | 116 +++++
 test/elixir/test/jwtauth_test.exs                  | 140 ++++++
 test/elixir/test/method_override_test.exs          |  55 +++
 test/elixir/test/proxyauth_test.exs                | 163 +++++++
 test/elixir/test/purge_test.exs                    | 168 +++++++
 test/elixir/test/recreate_doc_test.exs             | 165 +++++++
 test/elixir/test/replicator_db_bad_rep_id_test.exs |  81 ++++
 test/elixir/test/replicator_db_by_doc_id_test.exs  | 121 +++++
 test/elixir/test/users_db_test.exs                 |   3 +-
 test/elixir/test/utf8_test.exs                     |   2 +-
 test/elixir/test/view_offsets_test.exs             | 100 ++++
 test/elixir/test/view_pagination_test.exs          | 189 ++++++++
 test/javascript/cli_runner.js                      |  23 +-
 test/javascript/tests/changes.js                   |   6 +-
 test/javascript/tests/design_docs.js               |   2 +
 test/javascript/tests/design_docs_query.js         |   4 +-
 test/javascript/tests/design_options.js            |   5 +-
 test/javascript/tests/design_paths.js              |   3 +-
 test/javascript/tests/erlang_views.js              |   2 +-
 test/javascript/tests/form_submit.js               |   1 +
 test/javascript/tests/http.js                      |   3 +-
 test/javascript/tests/jsonp.js                     |   2 +
 test/javascript/tests/method_override.js           |   2 +
 test/javascript/tests/proxyauth.js                 |  51 +--
 test/javascript/tests/purge.js                     |   2 +-
 test/javascript/tests/recreate_doc.js              |   1 +
 test/javascript/tests/replicator_db_bad_rep_id.js  |   1 +
 test/javascript/tests/replicator_db_by_doc_id.js   |   1 +
 test/javascript/tests/view_offsets.js              |   2 +
 test/javascript/tests/view_pagination.js           |   2 +
 106 files changed, 5431 insertions(+), 1189 deletions(-)

diff --cc .gitignore
index c84d39e,6223d73..4bc87ec
--- a/.gitignore
+++ b/.gitignore
@@@ -11,10 -11,10 +11,12 @@@
  .DS_Store
  .vscode
  .rebar/
 +.rebar3/
 +.erlfdb/
  .eunit/
  cover/
+ core
+ debian/
  log
  apache-couchdb-*/
  bin/
diff --cc Makefile
index 35b62f9,53cea3b..5bef9c7
--- a/Makefile
+++ b/Makefile
@@@ -144,11 -144,10 +144,12 @@@ fauxton: share/ww
  ################################################################################
  
  
 -.PHONY: check
 +# When we can run all the tests with FDB switch this back to be the default
 +# "make check" command
 +.PHONY: check-all-tests
  # target: check - Test everything
 -check: all python-black
 +check-all-tests: all python-black
+ 	@$(MAKE) emilio
  	@$(MAKE) eunit
  	@$(MAKE) javascript
  	@$(MAKE) mango-test
@@@ -237,11 -227,10 +238,23 @@@ python-black-update: .venv/bin/blac
  elixir: export MIX_ENV=integration
  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 --no-eval --erlang-config=rel/files/eunit.config 'mix test --trace --exclude without_quorum_test --exclude with_quorum_test $(EXUNIT_OPTS)'
 -	@dev/run "$(TEST_OPTS)" -a adm:pass -n 1 \
++	@dev/run "$(TEST_OPTS)" \
++		-a adm:pass \
++		-n 1 \
++		--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)'
 +
 +.PHONY: elixir-only
 +elixir-only: devclean
- 	@dev/run "$(TEST_OPTS)" -a adm:pass -n 1 --enable-erlang-views --no-eval --erlang-config=rel/files/eunit.config 'mix test --trace --exclude without_quorum_test --exclude with_quorum_test $(EXUNIT_OPTS)'
++	@dev/run "$(TEST_OPTS)" \
++		-a adm:pass \
++		-n 1 \
+ 		--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)'
  
  .PHONY: elixir-init
  elixir-init: MIX_ENV=test
diff --cc rebar.config.script
index f3a9750,d8afc10..af25e61
--- a/rebar.config.script
+++ b/rebar.config.script
@@@ -134,19 -130,16 +134,20 @@@ SubDirs = 
      "src/ddoc_cache",
      "src/dreyfus",
      "src/fabric",
 +    "src/aegis",
 +    "src/couch_jobs",
 +    "src/couch_expiring_cache",
      "src/global_changes",
      "src/ioq",
+     "src/jwtf",
      "src/ken",
      "src/mango",
      "src/rexi",
      "src/setup",
      "src/smoosh",
 +    "src/ebtree",
      "rel"
- ],
+ ].
  
  DepDescs = [
  %% Independent Apps
@@@ -165,18 -157,14 +166,18 @@@
  %% Third party deps
  {folsom,           "folsom",           {tag, "CouchDB-0.8.3"}},
  {hyper,            "hyper",            {tag, "CouchDB-2.2.0-6"}},
 -{ibrowse,          "ibrowse",          {tag, "CouchDB-4.0.1-1"}},
 +{ibrowse,          "ibrowse",          {tag, "CouchDB-4.0.1-2"}},
 +{jaeger_passage,   "jaeger-passage",   {tag, "CouchDB-0.1.14-1"}},
  {jiffy,            "jiffy",            {tag, "CouchDB-1.0.4-1"}},
 +{local,            "local",            {tag, "0.2.1"}},
  {mochiweb,         "mochiweb",         {tag, "v2.20.0"}},
  {meck,             "meck",             {tag, "0.8.8"}},
 -{recon,            "recon",            {tag, "2.5.0"}}
 +{recon,            "recon",            {tag, "2.5.0"}},
 +{passage,          "passage",          {tag, "0.2.6"}},
 +{thrift_protocol,  "thrift-protocol",  {tag, "0.1.5"}}
- ],
+ ].
  
- WithProper = lists:keyfind(with_proper, 1, CouchConfig) == {with_proper, true},
+ WithProper = lists:keyfind(with_proper, 1, CouchConfig) == {with_proper, true}.
  
  OptionalDeps = case WithProper of
      true ->
@@@ -222,13 -210,8 +223,13 @@@ AddConfig = 
              sasl, setup, ssl, stdlib, syntax_tools, xmerl]},
          {warnings, [unmatched_returns, error_handling, race_conditions]}]},
      {post_hooks, [{compile, "escript support/build_js.escript"}]}
- ],
+ ].
  
 -C = lists:foldl(fun({K, V}, CfgAcc) ->
 -    lists:keystore(K, 1, CfgAcc, {K, V})
 +lists:foldl(fun({K, V}, CfgAcc) ->
 +    case lists:keyfind(K, 1, CfgAcc) of
 +        {K, Existent} when is_list(Existent) andalso is_list(V) ->
 +            lists:keystore(K, 1, CfgAcc, {K, Existent ++ V});
 +        false ->
 +            lists:keystore(K, 1, CfgAcc, {K, V})
 +    end
  end, CONFIG, AddConfig).
diff --cc src/mango/test/user_docs.py
index d69e6d6,617b430..c301983
--- a/src/mango/test/user_docs.py
+++ b/src/mango/test/user_docs.py
@@@ -59,8 -59,13 +59,12 @@@ def setup_users(db, **kwargs)
      db.save_docs(copy.deepcopy(USERS_DOCS))
  
  
+ def teardown_users(db):
+     [db.delete_doc(doc["_id"]) for doc in USERS_DOCS]
+ 
+ 
  def setup(db, index_type="view", **kwargs):
      db.recreate()
 -    db.save_docs(copy.deepcopy(DOCS))
      if index_type == "view":
          add_view_indexes(db, kwargs)
      elif index_type == "text":
diff --cc test/elixir/lib/couch.ex
index a843941,7819299..094f275
--- a/test/elixir/lib/couch.ex
+++ b/test/elixir/lib/couch.ex
@@@ -129,15 -125,10 +129,15 @@@ defmodule Couch d
    end
  
    def set_auth_options(options) do
 -    if Keyword.get(options, :cookie) == nil do
 +    no_auth? = Keyword.get(options, :no_auth) == true
 +    cookie? = Keyword.has_key?(options, :cookie)
 +    basic_auth? = Keyword.has_key?(options, :basic_auth)
 +    if cookie? or no_auth? or basic_auth? do
 +      Keyword.delete(options, :no_auth)
 +    else
        headers = Keyword.get(options, :headers, [])
- 
-       if headers[:basic_auth] != nil or headers[:authorization] != nil do
+       if headers[:basic_auth] != nil or headers[:authorization] != nil
+          or List.keymember?(headers, :"X-Auth-CouchDB-UserName", 0) do
          options
        else
          username = System.get_env("EX_USERNAME") || "adm"