davisp commented on a change in pull request #2131: add trace test for couch_views URL: https://github.com/apache/couchdb/pull/2131#discussion_r316775657
########## File path: src/couch_views/test/couch_views_trace_index_test.erl ########## @@ -0,0 +1,143 @@ +% Licensed under the Apache License, Version 2.0 (the "License"); you may not +% use this file except in compliance with the License. You may obtain a copy of +% the License at +% +% http://www.apache.org/licenses/LICENSE-2.0 +% +% Unless required by applicable law or agreed to in writing, software +% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +% License for the specific language governing permissions and limitations under +% the License. + + +-module(couch_views_trace_index_test). + + +-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"). + + +% Steps for this to work +% Run export FDB_NETWORK_OPTION_TRACE_ENABLE="" && +% make eunit apps=couch_views suites=couch_views_trace_index_test +% look in src/couch_views/.eunit for trace file +% Might need to add extra </Trace> to finish up file +% Analyze! + + +-define(EUNIT_FTW(Tests), [{with, [T]} || T <- Tests]). + + +indexer_test_() -> + { + "Trace view indexing", + { + setup, + fun setup/0, + fun cleanup/1, + { + foreach, + fun foreach_setup/0, + fun foreach_teardown/1, + ?EUNIT_FTW([ + fun trace_single_doc/1 + ]) + } + } + }. + + +setup() -> + Ctx = test_util:start_couch([ Review comment: This whole thing can be a one liner. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
