diff options
author | Nick Vatamaniuc <vatamane@gmail.com> | 2021-04-14 02:59:53 -0400 |
---|---|---|
committer | Nick Vatamaniuc <nickva@users.noreply.github.com> | 2021-04-16 17:44:43 -0400 |
commit | 870ba4cc6d02e628e70e753638de7b3adf88635f (patch) | |
tree | 7429ea2e14e590a8b36f8f20eb61d65b39e16f9f | |
parent | f005aba961d7a99128b54e8758b1ebd78bfa68c1 (diff) | |
download | couchdb-870ba4cc6d02e628e70e753638de7b3adf88635f.tar.gz |
Clean up tests after removing 3.x applications and couch_views updates
* Update the couch_views include paths
* Exclude non-existent applications from setup logic
* Do not run tests agains the backdoor port
* Do not run tests checking for non-existent system dbs
* Since "new" couch_att attachment format has changed a bit and encoding is
not `identity` and `md5` is not `<<>>` any longer, some tests had to be
updated to set those explicitly.
22 files changed, 59 insertions, 216 deletions
diff --git a/src/couch/src/test_util.erl b/src/couch/src/test_util.erl index 125e76492..c95c444f5 100644 --- a/src/couch/src/test_util.erl +++ b/src/couch/src/test_util.erl @@ -14,8 +14,6 @@ -include_lib("couch/include/couch_eunit.hrl"). -include("couch_db.hrl"). --include("couch_db_int.hrl"). --include("couch_bt_engine.hrl"). -export([init_code_path/0]). -export([source_file/1, build_file/1]). @@ -36,12 +34,10 @@ -export([start/1, start/2, start/3, stop/1]). --export([fake_db/1]). - -record(test_context, {mocked = [], started = [], module}). -define(DEFAULT_APPS, - [inets, ibrowse, ssl, config, couch_epi, couch_event, couch]). + [inets, ibrowse, ssl, config, couch_epi, couch]). srcdir() -> code:priv_dir(couch) ++ "/../../". @@ -54,8 +50,7 @@ init_code_path() -> "couchdb", "jiffy", "ibrowse", - "mochiweb", - "snappy" + "mochiweb" ], lists:foreach(fun(Name) -> code:add_patha(filename:join([builddir(), "src", Name])) @@ -248,7 +243,7 @@ start(Module, ExtraApps) -> start(Module, ExtraApps, []). start(Module, ExtraApps, Options) -> - Apps = start_applications([config, couch_log, ioq, couch_epi | ExtraApps]), + Apps = start_applications([config, couch_log, couch_epi | ExtraApps]), ToMock = [config, couch_stats] -- proplists:get_value(dont_mock, Options, []), mock(ToMock), #test_context{module = Module, mocked = ToMock, started = Apps}. @@ -257,37 +252,6 @@ stop(#test_context{mocked = Mocked, started = Apps}) -> meck:unload(Mocked), stop_applications(Apps). -fake_db(Fields0) -> - {ok, Db, Fields} = maybe_set_engine(Fields0), - Indexes = lists:zip( - record_info(fields, db), - lists:seq(2, record_info(size, db)) - ), - lists:foldl(fun({FieldName, Value}, Acc) -> - Idx = couch_util:get_value(FieldName, Indexes), - setelement(Idx, Acc, Value) - end, Db, Fields). - -maybe_set_engine(Fields0) -> - case lists:member(engine, Fields0) of - true -> - {ok, #db{}, Fields0}; - false -> - {ok, Header, Fields} = get_engine_header(Fields0), - Db = #db{engine = {couch_bt_engine, #st{header = Header}}}, - {ok, Db, Fields} - end. - -get_engine_header(Fields) -> - Keys = [disk_version, update_seq, unused, id_tree_state, - seq_tree_state, local_tree_state, purge_seq, purged_docs, - security_ptr, revs_limit, uuid, epochs, compacted_seq], - {HeadFields, RestFields} = lists:partition( - fun({K, _}) -> lists:member(K, Keys) end, Fields), - Header0 = couch_bt_engine_header:new(), - Header = couch_bt_engine_header:set(Header0, HeadFields), - {ok, Header, RestFields}. - now_us() -> {MegaSecs, Secs, MicroSecs} = os:timestamp(), (MegaSecs * 1000000 + Secs) * 1000000 + MicroSecs. diff --git a/src/couch/test/eunit/couch_db_mpr_tests.erl b/src/couch/test/eunit/couch_db_mpr_tests.erl index bb97c66d7..37137975e 100644 --- a/src/couch/test/eunit/couch_db_mpr_tests.erl +++ b/src/couch/test/eunit/couch_db_mpr_tests.erl @@ -31,8 +31,8 @@ setup() -> Hashed = couch_passwords:hash_admin_password(?PASS), ok = config:set("admins", ?USER, ?b2l(Hashed), _Persist=false), TmpDb = ?tempdb(), - Addr = config:get("httpd", "bind_address", "127.0.0.1"), - Port = mochiweb_socket_server:get(couch_httpd, port), + 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)]), Url. @@ -64,8 +64,12 @@ couch_db_mpr_test_() -> "multi-part attachment tests", { setup, - fun test_util:start_couch/0, - fun test_util:stop_couch/1, + fun() -> + test_util:start_couch([chttpd]) + end, + fun(Ctx) -> + test_util:stop_couch(Ctx) + end, { foreach, fun setup/0, diff --git a/src/couch/test/eunit/couch_doc_json_tests.erl b/src/couch/test/eunit/couch_doc_json_tests.erl index 51f228900..3a07642de 100644 --- a/src/couch/test/eunit/couch_doc_json_tests.erl +++ b/src/couch/test/eunit/couch_doc_json_tests.erl @@ -19,19 +19,19 @@ setup() -> mock(couch_log), mock(config), - mock(couch_db_plugin), + mock(fabric2_db_plugin), ok. teardown(_) -> meck:unload(couch_log), meck:unload(config), - meck:unload(couch_db_plugin), + meck:unload(fabric2_db_plugin), ok. -mock(couch_db_plugin) -> - ok = meck:new(couch_db_plugin, [passthrough]), - ok = meck:expect(couch_db_plugin, validate_docid, fun(_) -> false end), - ok; +mock(fabric2_db_plugin) -> + ok = meck:new(fabric2_db_plugin, [passthrough]), + ok = meck:expect(fabric2_db_plugin, validate_docid, fun(_) -> false end), + ok; mock(couch_log) -> ok = meck:new(couch_log, [passthrough]), ok = meck:expect(couch_log, debug, fun(_, _) -> ok end), @@ -52,7 +52,6 @@ json_doc_test_() -> fun(_) -> [{"Document from JSON", [ from_json_with_dbname_error_cases(), - from_json_with_db_name_success_cases(), from_json_success_cases(), from_json_error_cases() ]}, @@ -113,7 +112,9 @@ from_json_success_cases() -> {type, <<"application/awesome">>}, {att_len, 45}, {disk_len, 45}, - {revpos, undefined} + {revpos, undefined}, + {encoding, identity}, + {md5, <<>>} ]), couch_att:new([ {name, <<"noahs_private_key.gpg">>}, @@ -121,7 +122,9 @@ from_json_success_cases() -> {type, <<"application/pgp-signature">>}, {att_len, 18}, {disk_len, 18}, - {revpos, 0} + {revpos, 0}, + {encoding, undefined}, + {md5, undefined} ]) ]}, "Attachments are parsed correctly." @@ -173,44 +176,6 @@ from_json_success_cases() -> end, Cases). -from_json_with_db_name_success_cases() -> - Cases = [ - { - {[]}, - <<"_dbs">>, - #doc{}, - "DbName _dbs is acceptable with no docid" - }, - { - {[{<<"_id">>, <<"zing!">>}]}, - <<"_dbs">>, - #doc{id = <<"zing!">>}, - "DbName _dbs is acceptable with a normal docid" - }, - { - {[{<<"_id">>, <<"_users">>}]}, - <<"_dbs">>, - #doc{id = <<"_users">>}, - "_dbs/_users is acceptable" - }, - { - {[{<<"_id">>, <<"_replicator">>}]}, - <<"_dbs">>, - #doc{id = <<"_replicator">>}, - "_dbs/_replicator is acceptable" - }, - { - {[{<<"_id">>, <<"_global_changes">>}]}, - <<"_dbs">>, - #doc{id = <<"_global_changes">>}, - "_dbs/_global_changes is acceptable" - } - ], - lists:map( - fun({EJson, DbName, Expect, Msg}) -> - {Msg, ?_assertMatch(Expect, couch_doc:from_json_obj_validate(EJson, DbName))} - end, - Cases). from_json_error_cases() -> Cases = [ @@ -308,13 +273,6 @@ from_json_with_dbname_error_cases() -> Cases = [ { {[{<<"_id">>, <<"_random">>}]}, - <<"_dbs">>, - {illegal_docid, - <<"Only reserved document ids may start with underscore.">>}, - "Disallow non-system-DB underscore prefixed docids in _dbs database." - }, - { - {[{<<"_id">>, <<"_random">>}]}, <<"foobar">>, {illegal_docid, <<"Only reserved document ids may start with underscore.">>}, @@ -418,7 +376,9 @@ to_json_success_cases() -> {data, fun() -> ok end}, {revpos, 1}, {att_len, 400}, - {disk_len, 400} + {disk_len, 400}, + {md5, <<>>}, + {encoding, identity} ]), couch_att:new([ {name, <<"fast.json">>}, @@ -426,7 +386,9 @@ to_json_success_cases() -> {data, <<"{\"so\": \"there!\"}">>}, {revpos, 1}, {att_len, 16}, - {disk_len, 16} + {disk_len, 16}, + {md5, <<>>}, + {encoding, identity} ]) ]}, {[ @@ -457,13 +419,17 @@ to_json_success_cases() -> {data, fun() -> <<"diet pepsi">> end}, {revpos, 1}, {att_len, 10}, - {disk_len, 10} + {disk_len, 10}, + {md5, <<>>}, + {encoding, identity} ]), couch_att:new([ {name, <<"food.now">>}, {type, <<"application/food">>}, {revpos, 1}, - {data, <<"sammich">>} + {data, <<"sammich">>}, + {md5, <<>>}, + {encoding, identity} ]) ]}, {[ diff --git a/src/couch/test/eunit/couch_doc_tests.erl b/src/couch/test/eunit/couch_doc_tests.erl index cf41df61d..079b13f2b 100644 --- a/src/couch/test/eunit/couch_doc_tests.erl +++ b/src/couch/test/eunit/couch_doc_tests.erl @@ -42,7 +42,7 @@ doc_to_multi_part_stream_test() -> AttLength = size(AttData), Atts = [couch_att:new([ {name, <<"test">>}, {data, AttData}, {type, <<"text/plain">>}, - {att_len, AttLength}, {disk_len, AttLength}])], + {att_len, AttLength}, {disk_len, AttLength}, {encoding, identity}])], couch_doc:doc_to_multi_part_stream(Boundary, JsonBytes, Atts, fun send/1, true), AttLengthStr = integer_to_binary(AttLength), BoundaryLen = size(Boundary), @@ -69,51 +69,11 @@ len_doc_to_multi_part_stream_test() -> AttLength = size(AttData), Atts = [couch_att:new([ {name, <<"test">>}, {data, AttData}, {type, <<"text/plain">>}, - {att_len, AttLength}, {disk_len, AttLength}])], + {att_len, AttLength}, {disk_len, AttLength}, {encoding, identity}])], {ContentType, 258} = %% 258 is expected size of the document couch_doc:len_doc_to_multi_part_stream(Boundary, JsonBytes, Atts, true), ok. -validate_docid_test_() -> - {setup, - fun() -> - mock_config(), - ok = meck:new(couch_db_plugin, [passthrough]), - meck:expect(couch_db_plugin, validate_docid, fun(_) -> false end) - end, - fun(_) -> - meck:unload(config), - meck:unload(couch_db_plugin) - end, - [ - ?_assertEqual(ok, couch_doc:validate_docid(<<"idx">>)), - ?_assertEqual(ok, couch_doc:validate_docid(<<"_design/idx">>)), - ?_assertEqual(ok, couch_doc:validate_docid(<<"_local/idx">>)), - ?_assertEqual(ok, couch_doc:validate_docid(large_id(1024))), - ?_assertEqual(ok, couch_doc:validate_docid(<<"_users">>, <<"_dbs">>)), - ?_assertEqual(ok, couch_doc:validate_docid(<<"_replicator">>, <<"_dbs">>)), - ?_assertEqual(ok, couch_doc:validate_docid(<<"_global_changes">>, <<"_dbs">>)), - ?_assertThrow({illegal_docid, _}, - couch_doc:validate_docid(<<>>)), - ?_assertThrow({illegal_docid, _}, - couch_doc:validate_docid(<<16#80>>)), - ?_assertThrow({illegal_docid, _}, - couch_doc:validate_docid(<<"_idx">>)), - ?_assertThrow({illegal_docid, _}, - couch_doc:validate_docid(<<"_">>)), - ?_assertThrow({illegal_docid, _}, - couch_doc:validate_docid(<<"_design/">>)), - ?_assertThrow({illegal_docid, _}, - couch_doc:validate_docid(<<"_local/">>)), - ?_assertThrow({illegal_docid, _}, - couch_doc:validate_docid(large_id(1025))), - ?_assertThrow({illegal_docid, _}, - couch_doc:validate_docid(<<"_users">>, <<"foo">>)), - ?_assertThrow({illegal_docid, _}, - couch_doc:validate_docid(<<"_weeee">>, <<"_dbs">>)) - ] - }. - large_id(N) -> << <<"x">> || _ <- lists:seq(1, N) >>. @@ -139,7 +99,6 @@ mock_config() -> meck:expect(config, get, fun("couchdb", "max_document_id_length", "infinity") -> "1024"; ("couchdb", "max_attachment_size", "infinity") -> "infinity"; - ("mem3", "shards_db", "_dbs") -> "_dbs"; (Key, Val, Default) -> meck:passthrough([Key, Val, Default]) end ). diff --git a/src/couch/test/eunit/couch_query_servers_tests.erl b/src/couch/test/eunit/couch_query_servers_tests.erl index 440fc8e1b..46a8474cc 100644 --- a/src/couch/test/eunit/couch_query_servers_tests.erl +++ b/src/couch/test/eunit/couch_query_servers_tests.erl @@ -25,7 +25,7 @@ teardown(_) -> setup_oom() -> - test_util:start_couch([ioq]). + test_util:start_couch(). teardown_oom(Ctx) -> diff --git a/src/couch/test/eunit/couchdb_auth_tests.erl b/src/couch/test/eunit/couchdb_auth_tests.erl index 19d32d0c5..92f8a0a1c 100644 --- a/src/couch/test/eunit/couchdb_auth_tests.erl +++ b/src/couch/test/eunit/couchdb_auth_tests.erl @@ -49,7 +49,6 @@ auth_test_() -> fun() -> test_util:start_couch([chttpd]) end, fun test_util:stop_couch/1, [ make_test_cases(clustered, Tests), - make_test_cases(backdoor, Tests), make_require_valid_user_test_cases(clustered, RequireValidUserTests) ] } @@ -86,12 +85,6 @@ should_not_return_authenticated_field(_PortType, Url) -> <<"info">>, <<"authenticated">>]) end). -should_return_list_of_handlers(backdoor, Url) -> - ?_assertEqual([<<"cookie">>,<<"default">>], - begin - couch_util:get_nested_json_value(session(Url), [ - <<"info">>, <<"authentication_handlers">>]) - end); should_return_list_of_handlers(clustered, Url) -> ?_assertEqual([<<"cookie">>,<<"default">>], begin @@ -110,6 +103,4 @@ session(Url) -> jiffy:decode(Body). port(clustered) -> - integer_to_list(mochiweb_socket_server:get(chttpd, port)); -port(backdoor) -> - integer_to_list(mochiweb_socket_server:get(couch_httpd, port)). + integer_to_list(mochiweb_socket_server:get(chttpd, port)). diff --git a/src/couch/test/eunit/couchdb_cors_tests.erl b/src/couch/test/eunit/couchdb_cors_tests.erl index 82630bba7..0e0926c1f 100644 --- a/src/couch/test/eunit/couchdb_cors_tests.erl +++ b/src/couch/test/eunit/couchdb_cors_tests.erl @@ -26,21 +26,20 @@ ?assertEqual(lists:usort(A), lists:usort(B))). start() -> - Ctx = test_util:start_couch([ioq]), + Ctx = test_util:start_couch([chttpd]), ok = config:set("httpd", "enable_cors", "true", false), ok = config:set("vhosts", "example.com", "/", false), Ctx. setup() -> DbName = ?tempdb(), - {ok, Db} = couch_db:create(DbName, [?ADMIN_CTX]), - couch_db:close(Db), + {ok, _} = fabric2_db:create(DbName, [?ADMIN_CTX]), config:set("cors", "credentials", "false", false), config:set("cors", "origins", "http://example.com", false), Addr = config:get("httpd", "bind_address", "127.0.0.1"), - Port = integer_to_list(mochiweb_socket_server:get(couch_httpd, port)), + Port = integer_to_list(mochiweb_socket_server:get(chttpd, port)), Host = "http://" ++ Addr ++ ":" ++ Port, {Host, ?b2l(DbName)}. @@ -57,7 +56,7 @@ setup({Mod, VHost}) -> {Host, DbName, Url, DefaultHeaders}. teardown(DbName) when is_list(DbName) -> - ok = couch_server:delete(?l2b(DbName), [?ADMIN_CTX]), + ok = fabric2_db:delete(?l2b(DbName), [?ADMIN_CTX]), ok; teardown({_, DbName}) -> teardown(DbName). diff --git a/src/couch/test/eunit/couchdb_mrview_cors_tests.erl b/src/couch/test/eunit/couchdb_mrview_cors_tests.erl index 0f69048a0..a9215f5d7 100644 --- a/src/couch/test/eunit/couchdb_mrview_cors_tests.erl +++ b/src/couch/test/eunit/couchdb_mrview_cors_tests.erl @@ -70,8 +70,7 @@ show_tests() -> { "Check CORS for show", [ - make_test_case(clustered, [fun should_make_shows_request/2]), - make_test_case(backdoor, [fun should_make_shows_request/2]) + make_test_case(clustered, [fun should_make_shows_request/2]) ] }. @@ -86,22 +85,14 @@ should_make_shows_request(_, {Host, DbName}) -> ReqUrl = Host ++ "/" ++ DbName ++ "/_design/foo/_show/bar", Headers = [{"Origin", "http://example.com"}, {"Access-Control-Request-Method", "GET"}, ?AUTH], - {ok, _, Resp, Body} = test_request:get(ReqUrl, Headers), - Origin = proplists:get_value("Access-Control-Allow-Origin", Resp), - ?assertEqual("http://example.com", Origin), - ?assertEqual(<<"<h1>wosh</h1>">>, Body) + ?assertMatch({ok, 410, _, _}, test_request:get(ReqUrl, Headers)) end). -create_db(backdoor, DbName) -> - {ok, Db} = couch_db:create(DbName, [?ADMIN_CTX]), - couch_db:close(Db); create_db(clustered, DbName) -> {ok, Status, _, _} = test_request:put(db_url(DbName), [?AUTH], ""), assert_success(create_db, Status), ok. -delete_db(backdoor, DbName) -> - couch_server:delete(DbName, [?ADMIN_CTX]); delete_db(clustered, DbName) -> {ok, Status, _, _} = test_request:delete(db_url(DbName), [?AUTH]), assert_success(delete_db, Status), @@ -119,7 +110,6 @@ host_url(PortType) -> bind_address(PortType) -> config:get(section(PortType), "bind_address", "127.0.0.1"). -section(backdoor) -> "http"; section(clustered) -> "chttpd". db_url(DbName) when is_binary(DbName) -> @@ -128,9 +118,7 @@ db_url(DbName) when is_list(DbName) -> host_url(clustered) ++ "/" ++ DbName. port(clustered) -> - integer_to_list(mochiweb_socket_server:get(chttpd, port)); -port(backdoor) -> - integer_to_list(mochiweb_socket_server:get(couch_httpd, port)). + integer_to_list(mochiweb_socket_server:get(chttpd, port)). upload_ddoc(Host, DbName) -> diff --git a/src/couch_views/test/couch_views_batch_test.erl b/src/couch_views/test/couch_views_batch_test.erl index 78e68925e..d4dbb50c5 100644 --- a/src/couch_views/test/couch_views_batch_test.erl +++ b/src/couch_views/test/couch_views_batch_test.erl @@ -15,7 +15,7 @@ -include_lib("eunit/include/eunit.hrl"). -include_lib("fabric/test/fabric2_test.hrl"). --include_lib("couch_mrview/include/couch_mrview.hrl"). +-include_lib("couch_views/include/couch_views.hrl"). batch_test_() -> diff --git a/src/couch_views/test/couch_views_cleanup_test.erl b/src/couch_views/test/couch_views_cleanup_test.erl index 54048c968..d1b6f2adc 100644 --- a/src/couch_views/test/couch_views_cleanup_test.erl +++ b/src/couch_views/test/couch_views_cleanup_test.erl @@ -17,7 +17,6 @@ -include_lib("couch/include/couch_eunit.hrl"). -include_lib("eunit/include/eunit.hrl"). -include_lib("couch_views/include/couch_views.hrl"). --include_lib("couch_mrview/include/couch_mrview.hrl"). -include_lib("fabric/include/fabric2.hrl"). -include_lib("fabric/test/fabric2_test.hrl"). diff --git a/src/couch_views/test/couch_views_custom_red_test.erl b/src/couch_views/test/couch_views_custom_red_test.erl index 911846d69..e8f8cbc2f 100644 --- a/src/couch_views/test/couch_views_custom_red_test.erl +++ b/src/couch_views/test/couch_views_custom_red_test.erl @@ -14,7 +14,6 @@ -include_lib("couch/include/couch_eunit.hrl"). -include_lib("couch/include/couch_db.hrl"). --include_lib("couch_mrview/include/couch_mrview.hrl"). -include_lib("fabric/test/fabric2_test.hrl"). -include("couch_views.hrl"). diff --git a/src/couch_views/test/couch_views_indexer_test.erl b/src/couch_views/test/couch_views_indexer_test.erl index 69186468d..c41db3b4f 100644 --- a/src/couch_views/test/couch_views_indexer_test.erl +++ b/src/couch_views/test/couch_views_indexer_test.erl @@ -15,7 +15,6 @@ -include_lib("eunit/include/eunit.hrl"). -include_lib("couch/include/couch_db.hrl"). -include_lib("couch/include/couch_eunit.hrl"). --include_lib("couch_mrview/include/couch_mrview.hrl"). -include_lib("couch_views/include/couch_views.hrl"). -include_lib("fabric/test/fabric2_test.hrl"). diff --git a/src/couch_views/test/couch_views_info_test.erl b/src/couch_views/test/couch_views_info_test.erl index 993801a0d..18a0a63bb 100644 --- a/src/couch_views/test/couch_views_info_test.erl +++ b/src/couch_views/test/couch_views_info_test.erl @@ -15,7 +15,7 @@ -include_lib("couch/include/couch_eunit.hrl"). -include_lib("couch/include/couch_db.hrl"). --include_lib("couch_mrview/include/couch_mrview.hrl"). +-include_lib("couch_views/include/couch_views.hrl"). -include_lib("fabric/test/fabric2_test.hrl"). diff --git a/src/couch_views/test/couch_views_map_test.erl b/src/couch_views/test/couch_views_map_test.erl index 125b43da7..97e35cc9a 100644 --- a/src/couch_views/test/couch_views_map_test.erl +++ b/src/couch_views/test/couch_views_map_test.erl @@ -14,7 +14,6 @@ -include_lib("couch/include/couch_eunit.hrl"). -include_lib("couch/include/couch_db.hrl"). --include_lib("couch_mrview/include/couch_mrview.hrl"). -include("couch_views.hrl"). @@ -567,27 +566,6 @@ check_local_seq(Val, Expected) -> ?assertEqual(Expected, Result). -% should_give_ext_size_seq_indexed_test(Db) -> -% DDoc = couch_doc:from_json_obj({[ -% {<<"_id">>, <<"_design/seqdoc">>}, -% {<<"options">>, {[{<<"seq_indexed">>, true}]}}, -% {<<"views">>, {[ -% {<<"view1">>, {[ -% {<<"map">>, <<"function(doc){emit(doc._id, doc._id);}">>} -% ]}} -% ]} -% } -% ]}), -% {ok, _} = couch_db:update_doc(Db, DDoc, []), -% {ok, Db1} = couch_db:open_int(couch_db:name(Db), []), -% {ok, DDoc1} = couch_db:open_doc(Db1, <<"_design/seqdoc">>, [ejson_body]), -% couch_mrview:query_view(Db1, DDoc1, <<"view1">>, [{update, true}]), -% {ok, Info} = couch_mrview:get_info(Db1, DDoc), -% Size = couch_util:get_nested_json_value({Info}, [sizes, external]), -% ok = couch_db:close(Db1), -% ?assert(is_number(Size)). - - run_query(Idx, Args) -> run_query(Idx, Args, false). diff --git a/src/couch_views/test/couch_views_size_test.erl b/src/couch_views/test/couch_views_size_test.erl index e69b5b292..91684a9ba 100644 --- a/src/couch_views/test/couch_views_size_test.erl +++ b/src/couch_views/test/couch_views_size_test.erl @@ -15,7 +15,6 @@ -include_lib("eunit/include/eunit.hrl"). -include_lib("couch/include/couch_db.hrl"). -include_lib("couch/include/couch_eunit.hrl"). --include_lib("couch_mrview/include/couch_mrview.hrl"). -include_lib("couch_views/include/couch_views.hrl"). -include_lib("fabric/test/fabric2_test.hrl"). @@ -353,4 +352,4 @@ fold_fun({meta, _Meta}, Acc) -> fold_fun({row, _} = Row, Acc) -> {ok, [Row | Acc]}; fold_fun(complete, Acc) -> - {ok, lists:reverse(Acc)}.
\ No newline at end of file + {ok, lists:reverse(Acc)}. diff --git a/src/couch_views/test/couch_views_trace_index_test.erl b/src/couch_views/test/couch_views_trace_index_test.erl index 03c21a34a..346a99c60 100644 --- a/src/couch_views/test/couch_views_trace_index_test.erl +++ b/src/couch_views/test/couch_views_trace_index_test.erl @@ -17,7 +17,7 @@ -include_lib("eunit/include/eunit.hrl"). -include_lib("couch/include/couch_db.hrl"). -include_lib("couch/include/couch_eunit.hrl"). --include_lib("couch_mrview/include/couch_mrview.hrl"). +-include_lib("couch_views/include/couch_views.hrl"). % Steps for this to work diff --git a/src/couch_views/test/couch_views_updater_test.erl b/src/couch_views/test/couch_views_updater_test.erl index aadbe940b..1bd637dd6 100644 --- a/src/couch_views/test/couch_views_updater_test.erl +++ b/src/couch_views/test/couch_views_updater_test.erl @@ -14,10 +14,9 @@ -include_lib("couch/include/couch_db.hrl"). -include_lib("couch/include/couch_eunit.hrl"). --include_lib("couch_mrview/include/couch_mrview.hrl"). +-include_lib("couch_views/include/couch_views.hrl"). -include_lib("fabric/test/fabric2_test.hrl"). -include_lib("mango/src/mango_idx.hrl"). --include_lib("couch_views/include/couch_views.hrl"). indexer_test_() -> diff --git a/src/couch_views/test/couch_views_upgrade_test.erl b/src/couch_views/test/couch_views_upgrade_test.erl index 556a76297..3926db347 100644 --- a/src/couch_views/test/couch_views_upgrade_test.erl +++ b/src/couch_views/test/couch_views_upgrade_test.erl @@ -15,7 +15,6 @@ -include_lib("eunit/include/eunit.hrl"). -include_lib("couch/include/couch_db.hrl"). -include_lib("couch/include/couch_eunit.hrl"). --include_lib("couch_mrview/include/couch_mrview.hrl"). -include_lib("couch_views/include/couch_views.hrl"). -include_lib("fabric/include/fabric2.hrl"). -include_lib("fabric/test/fabric2_test.hrl"). @@ -397,4 +396,4 @@ doc(Id, Val) -> run_query(#{} = Db, DDoc, <<_/binary>> = View) -> - couch_views:query(Db, DDoc, View, fun fold_fun/2, [], #mrargs{}).
\ No newline at end of file + couch_views:query(Db, DDoc, View, fun fold_fun/2, [], #mrargs{}). diff --git a/src/fabric/test/fabric2_dir_prefix_tests.erl b/src/fabric/test/fabric2_dir_prefix_tests.erl index 2943d6533..8eacfaf82 100644 --- a/src/fabric/test/fabric2_dir_prefix_tests.erl +++ b/src/fabric/test/fabric2_dir_prefix_tests.erl @@ -23,10 +23,10 @@ dir_prefix_test_() -> "Test couchdb fdb directory prefix", setup, fun() -> - % erlfdb, rexi and mem3 are all dependent apps for fabric. We make + % erlfdb, ctrace are all dependent apps for fabric. We make % sure to start them so when fabric is started during the test it % already has its dependencies - test_util:start_couch([erlfdb, rexi, mem3, ctrace, fabric]) + test_util:start_couch([erlfdb, ctrace, fabric]) end, fun(Ctx) -> config:delete("fabric", "fdb_directory"), diff --git a/src/fabric/test/fabric2_node_types_tests.erl b/src/fabric/test/fabric2_node_types_tests.erl index 074afe86b..98bfd7e18 100644 --- a/src/fabric/test/fabric2_node_types_tests.erl +++ b/src/fabric/test/fabric2_node_types_tests.erl @@ -25,10 +25,10 @@ node_types_test_() -> os:putenv("COUCHDB_NODE_TYPE_FOO", "false"), os:putenv("COUCHDB_NODE_TYPE_BAZ", "true"), os:putenv("COUCHDB_NODE_TYPE_ZIG", ""), - % erlfdb, rexi and mem3 are all dependent apps for fabric. We make + % erlfdb, ctrace are all dependent apps for fabric. We make % sure to start them so when fabric is started during the test it % already has its dependencies - test_util:start_couch([erlfdb, rexi, mem3, ctrace, fabric]) + test_util:start_couch([erlfdb, ctrace, fabric]) end, fun(Ctx) -> test_util:stop_couch(Ctx), diff --git a/src/fabric/test/fabric2_tx_options_tests.erl b/src/fabric/test/fabric2_tx_options_tests.erl index 78428c6e4..b326464d4 100644 --- a/src/fabric/test/fabric2_tx_options_tests.erl +++ b/src/fabric/test/fabric2_tx_options_tests.erl @@ -26,10 +26,10 @@ fdb_tx_options_test_() -> setup, fun() -> meck:new(erlfdb, [passthrough]), - % erlfdb, rexi and mem3 are all dependent apps for fabric. We make + % erlfdb, ctrace are all dependent apps for fabric. We make % sure to start them so when fabric is started during the test it % already has its dependencies - test_util:start_couch([erlfdb, rexi, mem3, ctrace, fabric]) + test_util:start_couch([erlfdb, ctrace, fabric]) end, fun(Ctx) -> meck:unload(), diff --git a/test/elixir/lib/step/create_db.ex b/test/elixir/lib/step/create_db.ex index d38e6722f..412c85898 100644 --- a/test/elixir/lib/step/create_db.ex +++ b/test/elixir/lib/step/create_db.ex @@ -36,7 +36,7 @@ defmodule Couch.Test.Setup.Step.Create.DB do def setup(setup, %__MODULE__{name: name} = step) do assert Setup.completed?(setup, Step.Start), "Require `Start` step" assert :fabric in Step.Start.apps(), "Fabric is not started" - res = :fabric.create_db(name, [@admin]) + res = :fabric2_db.create_db(name, [@admin]) assert res in [:ok, :accepted], "Cannot create `#{name}` database" step end |