pgj commented on code in PR #4662:
URL: https://github.com/apache/couchdb/pull/4662#discussion_r1306562240
##########
src/mango/src/mango_idx.erl:
##########
@@ -479,7 +500,186 @@ get_legacy_selector(Def) ->
end.
-ifdef(TEST).
--include_lib("eunit/include/eunit.hrl").
+-include_lib("couch/include/couch_eunit.hrl").
+
+get_usable_indexes_test_() ->
+ {
+ foreach,
+ fun() ->
+ meck:new(fabric_util),
+ meck:new(ddoc_cache),
+ meck:new(mango_idx_special),
+ meck:new(mango_idx_view),
+ meck:new(mango_sort),
+ meck:new(mango_cursor)
Review Comment:
For some reason, if `fabric_util` is not present there, `eunit` will give a
`not_mocked` error.
```console
$ make eunit apps=mango
[..]
module 'mango_idx'
mango_idx:514: -get_usable_indexes_test_/0-fun-4-
(t_get_usable_indexes_empty)...[0.237 s] ok
mango_idx:515: -get_usable_indexes_test_/0-fun-2-
(t_get_usable_indexes_regular)...*failed*
in function meck_proc:gen_server/3 (src/meck_proc.erl, line 491)
in call from meck_history:num_calls/4 (src/meck_history.erl, line 80)
in call from meck:called/3 (src/meck.erl, line 497)
in call from mango_idx:t_get_usable_indexes_regular/1 (src/mango_idx.erl,
line 619)
in call from eunit_test:run_testfun/1 (eunit_test.erl, line 71)
in call from eunit_proc:run_test/1 (eunit_proc.erl, line 531)
in call from eunit_proc:with_timeout/3 (eunit_proc.erl, line 356)
in call from eunit_proc:handle_test/2 (eunit_proc.erl, line 514)
**error:{not_mocked,fabric_util}
output:<<"">>
mango_idx:516: -get_usable_indexes_test_/0-fun-0-
(t_get_usable_indexes_user_specified_index)...*failed*
in function meck_proc:gen_server/3 (src/meck_proc.erl, line 491)
in call from meck_history:num_calls/4 (src/meck_history.erl, line 80)
in call from meck:called/3 (src/meck.erl, line 497)
in call from mango_idx:t_get_usable_indexes_user_specified_index/1
(src/mango_idx.erl, line 670)
in call from eunit_test:run_testfun/1 (eunit_test.erl, line 71)
in call from eunit_proc:run_test/1 (eunit_proc.erl, line 531)
in call from eunit_proc:with_timeout/3 (eunit_proc.erl, line 356)
in call from eunit_proc:handle_test/2 (eunit_proc.erl, line 514)
**error:{not_mocked,fabric_util}
output:<<"">>
mango_idx: get_partial_filter_all_docs_test...ok
mango_idx: get_partial_filter_undefined_def_test...ok
mango_idx: get_partial_filter_selector_default_test...ok
mango_idx: get_partial_filter_selector_missing_test...ok
mango_idx: get_partial_filter_selector_with_selector_test...ok
mango_idx: get_partial_filter_selector_with_legacy_selector_test...ok
mango_idx:
get_partial_filter_selector_with_legacy_default_selector_test...ok
mango_idx: get_idx_ddoc_name_only_test...ok
mango_idx: get_idx_ddoc_design_slash_name_test...ok
[done in 1.576 s]
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]