You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2020/02/14 09:21:17 UTC

[couchdb] branch mango-eunit-test-fixes created (now 380a6ff)

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

jaydoane pushed a change to branch mango-eunit-test-fixes
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


      at 380a6ff  Fix mango_cursor_view tests

This branch includes the following new commits:

     new d43d939  Fix mango_indexer_test
     new 8bf4967  Suppress compiler warnings
     new e01efe1  Fix mango_jobs_indexer_test
     new caceed4  Fix mango_idx tests
     new 380a6ff  Fix mango_cursor_view tests

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[couchdb] 02/05: Suppress compiler warnings

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jaydoane pushed a commit to branch mango-eunit-test-fixes
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 8bf49670d6b45bf46261be0df9d2ef4d971acdc0
Author: Jay Doane <ja...@apache.org>
AuthorDate: Thu Feb 13 21:59:04 2020 -0800

    Suppress compiler warnings
---
 src/mango/src/mango_fdb.erl     |  3 +--
 src/mango/src/mango_indexer.erl | 23 +++++++++++------------
 src/mango/src/mango_jobs.erl    |  4 ----
 3 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/src/mango/src/mango_fdb.erl b/src/mango/src/mango_fdb.erl
index 1e95454..769fdc9 100644
--- a/src/mango/src/mango_fdb.erl
+++ b/src/mango/src/mango_fdb.erl
@@ -60,8 +60,7 @@ get_build_vs(TxDb, #idx{} = Idx) ->
 
 get_build_vs(TxDb, DDoc) ->
     #{
-        tx := Tx,
-        db_prefix := DbPrefix
+        tx := Tx
     } = TxDb,
     Key = build_vs_key(TxDb, DDoc),
     EV = erlfdb:wait(erlfdb:get(Tx, Key)),
diff --git a/src/mango/src/mango_indexer.erl b/src/mango/src/mango_indexer.erl
index c7632a7..d00a254 100644
--- a/src/mango/src/mango_indexer.erl
+++ b/src/mango/src/mango_indexer.erl
@@ -178,15 +178,14 @@ should_index(Selector, Doc) ->
     Matches and not IsDesign.
 
 
-validate_index_info(IndexInfo) ->
-    IdxTypes = [mango_idx_view, mango_idx_text],
-    Results = lists:foldl(fun(IdxType, Results0) ->
-        try
-            IdxType:validate_index_def(IndexInfo),
-            [valid_index | Results0]
-        catch _:_ ->
-            [invalid_index | Results0]
-        end
-    end, [], IdxTypes),
-    lists:member(valid_index, Results).
-
+%% validate_index_info(IndexInfo) ->
+%%     IdxTypes = [mango_idx_view, mango_idx_text],
+%%     Results = lists:foldl(fun(IdxType, Results0) ->
+%%         try
+%%             IdxType:validate_index_def(IndexInfo),
+%%             [valid_index | Results0]
+%%         catch _:_ ->
+%%             [invalid_index | Results0]
+%%         end
+%%     end, [], IdxTypes),
+%%     lists:member(valid_index, Results).
diff --git a/src/mango/src/mango_jobs.erl b/src/mango/src/mango_jobs.erl
index c5a70ff..fd83254 100644
--- a/src/mango/src/mango_jobs.erl
+++ b/src/mango/src/mango_jobs.erl
@@ -27,10 +27,6 @@ set_timeout() ->
 
 
 build_index(TxDb, #idx{} = Idx) ->
-    #{
-        tx := Tx
-    } = TxDb,
-
     mango_fdb:create_build_vs(TxDb, Idx),
 
     JobId = job_id(TxDb, Idx),


[couchdb] 03/05: Fix mango_jobs_indexer_test

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jaydoane pushed a commit to branch mango-eunit-test-fixes
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit e01efe19107072a709656e1f8fe84e8e50537161
Author: Jay Doane <ja...@apache.org>
AuthorDate: Fri Feb 14 00:50:52 2020 -0800

    Fix mango_jobs_indexer_test
---
 src/mango/test/eunit/mango_jobs_indexer_test.erl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mango/test/eunit/mango_jobs_indexer_test.erl b/src/mango/test/eunit/mango_jobs_indexer_test.erl
index 9641163..2551655 100644
--- a/src/mango/test/eunit/mango_jobs_indexer_test.erl
+++ b/src/mango/test/eunit/mango_jobs_indexer_test.erl
@@ -76,7 +76,7 @@ index_docs(Db) ->
         [{id, <<"3">>}, {value, 3}],
         [{id, <<"4">>}, {value, 4}],
         [{id, <<"5">>}, {value, 5}]
-], Docs).
+    ], Docs).
 
 
 index_lots_of_docs(Db) ->
@@ -186,7 +186,7 @@ doc(Id) ->
     ]}).
 
 
-query_cb({doc, Doc}, #cursor{user_acc = Acc} = Cursor) ->
+query_cb({doc, _, Doc}, #cursor{user_acc = Acc} = Cursor) ->
     {ok, Cursor#cursor{
         user_acc =  Acc ++ [Doc]
     }}.


[couchdb] 05/05: Fix mango_cursor_view tests

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jaydoane pushed a commit to branch mango-eunit-test-fixes
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 380a6ffb6e3bc1d69fccd84aa23ac89ed2b54ec3
Author: Jay Doane <ja...@apache.org>
AuthorDate: Fri Feb 14 01:20:18 2020 -0800

    Fix mango_cursor_view tests
    
    Wrap `RowProps` in a tuple, and correctly order assertions.
    
    Note that `does_not_run_match_on_doc_with_value_test` still fails with
    a `no_match`.
---
 src/mango/src/mango_cursor_view.erl | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mango/src/mango_cursor_view.erl b/src/mango/src/mango_cursor_view.erl
index a986844..22ff6a8 100644
--- a/src/mango/src/mango_cursor_view.erl
+++ b/src/mango/src/mango_cursor_view.erl
@@ -526,8 +526,8 @@ runs_match_on_doc_with_no_value_test() ->
             ]
         }}
     ],
-    {Match, _, _} = doc_member(Cursor, RowProps),
-    ?assertEqual(Match, no_match).
+    {Match, _, _} = doc_member(Cursor, {RowProps}),
+    ?assertEqual(no_match, Match).
 
 does_not_run_match_on_doc_with_value_test() ->
     Cursor = #cursor {
@@ -548,8 +548,8 @@ does_not_run_match_on_doc_with_value_test() ->
             ]
         }}
     ],
-    {Match, _, _} = doc_member(Cursor, RowProps),
-    ?assertEqual(Match, ok).
+    {Match, _, _} = doc_member(Cursor, {RowProps}),
+    ?assertEqual(ok, Match).
 
 
 -endif.


[couchdb] 01/05: Fix mango_indexer_test

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jaydoane pushed a commit to branch mango-eunit-test-fixes
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit d43d939737d459c47a688deb790e75ce15d0c28f
Author: Jay Doane <ja...@apache.org>
AuthorDate: Thu Feb 13 21:54:03 2020 -0800

    Fix mango_indexer_test
    
    The callback first argument shape changed to `{doc, SortKeys, JsonDoc}`.
---
 src/mango/test/eunit/mango_indexer_test.erl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mango/test/eunit/mango_indexer_test.erl b/src/mango/test/eunit/mango_indexer_test.erl
index ee24b21..ba0144f 100644
--- a/src/mango/test/eunit/mango_indexer_test.erl
+++ b/src/mango/test/eunit/mango_indexer_test.erl
@@ -155,7 +155,7 @@ doc(Id) ->
     ]}).
 
 
-query_cb({doc, Doc}, #cursor{user_acc = Acc} = Cursor) ->
+query_cb({doc, _, Doc}, #cursor{user_acc = Acc} = Cursor) ->
     {ok, Cursor#cursor{
         user_acc =  Acc ++ [Doc]
     }}.


[couchdb] 04/05: Fix mango_idx tests

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jaydoane pushed a commit to branch mango-eunit-test-fixes
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit caceed494bc67a372b265c33063d9537fc4f6d58
Author: Jay Doane <ja...@apache.org>
AuthorDate: Fri Feb 14 01:15:04 2020 -0800

    Fix mango_idx tests
---
 src/mango/src/mango_idx.erl | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/mango/src/mango_idx.erl b/src/mango/src/mango_idx.erl
index f1be029..b861d52 100644
--- a/src/mango/src/mango_idx.erl
+++ b/src/mango/src/mango_idx.erl
@@ -535,7 +535,8 @@ filter_opts([Opt | Rest]) ->
     [Opt | filter_opts(Rest)].
 
 
-get_partial_filter_selector(#idx{def = Def}) when Def =:= all_docs; Def =:= undefined ->
+get_partial_filter_selector(#idx{def = Def})
+        when Def =:= all_docs; Def =:= undefined ->
     undefined;
 get_partial_filter_selector(#idx{def = {Def}}) ->
     case proplists:get_value(<<"partial_filter_selector">>, Def) of
@@ -558,14 +559,18 @@ get_legacy_selector(Def) ->
 -include_lib("eunit/include/eunit.hrl").
 
 index(SelectorName, Selector) ->
-    {
-        idx,<<"mango_test_46418cd02081470d93290dc12306ebcb">>,
-           <<"_design/57e860dee471f40a2c74ea5b72997b81dda36a24">>,
-           <<"Selected">>,<<"json">>,
-           {[{<<"fields">>,{[{<<"location">>,<<"asc">>}]}},
-             {SelectorName,{Selector}}]},
-           false,
-           [{<<"def">>,{[{<<"fields">>,[<<"location">>]}]}}]
+    #idx{
+        dbname = <<"mango_test_46418cd02081470d93290dc12306ebcb">>,
+        ddoc = <<"_design/57e860dee471f40a2c74ea5b72997b81dda36a24">>,
+        name = <<"Selected">>,
+        type = <<"json">>,
+        def = {[
+            {<<"fields">>, {[{<<"location">>,<<"asc">>}]}},
+            {SelectorName, {Selector}}
+        ]},
+        partitioned = false,
+        opts = [{<<"def">>,{[{<<"fields">>,[<<"location">>]}]}}],
+        build_status = undefined
     }.
 
 get_partial_filter_all_docs_test() ->