iilyak commented on a change in pull request #497: notify couch_index_processes on all shards when ddoc updated URL: https://github.com/apache/couchdb/pull/497#discussion_r115046818
########## File path: src/couch_index/test/couch_index_ddoc_updated_tests.erl ########## @@ -0,0 +1,135 @@ +% 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_index_ddoc_updated_tests). + +-include_lib("couch/include/couch_eunit.hrl"). +-include_lib("couch/include/couch_db.hrl"). + + +start() -> + Ctx = test_util:start_couch([mem3, fabric]), + DbName = ?tempdb(), + ok = fabric:create_db(DbName, [?ADMIN_CTX]), + {Ctx, DbName}. + +stop({Ctx, DbName}) -> + ok = fabric:delete_db(DbName, [?ADMIN_CTX]), + DbDir = config:get("couchdb", "database_dir", "."), + WaitFun = fun() -> + filelib:fold_files(DbDir, <<".*", DbName/binary, "\.[0-9]+.*">>, + true, fun(_F, _A) -> wait end, ok) + end, + ok = test_util:wait(WaitFun), + test_util:stop_couch(Ctx), + (catch meck:unload(test_index)), + ok. + + +ddoc_update_test_() -> + { + "Check ddoc update actions", + { + setup, + fun start/0, fun stop/1, + fun check_all_indexers_exit_on_ddoc_change/1 + } + }. + + +check_all_indexers_exit_on_ddoc_change({_Ctx, DbName}) -> + ?_test(begin + fake_index(), + [Db1 | RestDbs] = lists:map(fun(Sh) -> Review comment: These are not `Dbs`. They are `DbOpenShards` or something. Feel free to ignore since it is minor. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on 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
