1#!/usr/bin/env escript
2%% -*- Mode: Erlang; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
3%%! -smp enable
4
5% Licensed under the Apache License, Version 2.0 (the "License"); you may not
6% use this file except in compliance with the License. You may obtain a copy of
7% the License at
8%
9%   http://www.apache.org/licenses/LICENSE-2.0
10%
11% Unless required by applicable law or agreed to in writing, software
12% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14% License for the specific language governing permissions and limitations under
15% the License.
16
17main(_) ->
18    test_util:init_code_path(),
19
20    etap:plan(1),
21    case (catch test()) of
22        ok ->
23            etap:end_tests();
24        Other ->
25            etap:diag(io_lib:format("Test died abnormally: ~p", [Other])),
26            etap:bail(Other)
27    end,
28    ok.
29
30
31test() ->
32    % Purpose of this test is to create all system databases (_users, _replicator)
33    % before we start running all other tests in parallel. When the other tests start
34    % in parallel, if the system databases don't exist, they will all attempt to create
35    % them, and 1 succeeds while others will fail.
36    couch_set_view_test_util:start_server(),
37    {ok, RepDb} = couch_db:open_int(<<"_replicator">>, []),
38    {ok, _} = couch_db:ensure_full_commit(RepDb),
39    ok = couch_db:close(RepDb),
40    etap:is(true, true, "Preparation for parallel testing done"),
41    couch_set_view_test_util:stop_server(),
42    ok.
43