machi/test/machi_flu_psup_test.erl

71 lines
2.6 KiB
Erlang
Raw Normal View History

%% -------------------------------------------------------------------
%%
%% Copyright (c) 2007-2015 Basho Technologies, Inc. All Rights Reserved.
%%
%% This file is provided to you 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.
%%
%% -------------------------------------------------------------------
%% @doc The Machi write-once projection store service.
%%
%% This API is gen_server-style message passing, intended for use
%% within a single Erlang node to glue together the projection store
%% server with the node-local process that implements Machi's TCP
%% client access protocol (on the "server side" of the TCP connection).
%%
%% All Machi client access to the projection store SHOULD NOT use this
%% module's API.
%%
%% The projection store is implemented by an Erlang/OTP `gen_server'
%% process that is associated with each FLU. Conceptually, the
%% projection store is an array of write-once registers. For each
%% projection store register, the key is a 2-tuple of an epoch number
%% (`non_neg_integer()' type) and a projection type (`public' or
%% `private' type); the value is a projection data structure
%% (`projection_v1()' type).
-module(machi_flu_psup_test).
-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").
smoke_test() ->
2015-05-01 05:51:42 +00:00
[os:cmd("rm -rf " ++ X) || X <- ["./data.a", "./data.b", "/data.c"] ],
2015-04-30 14:16:08 +00:00
{ok, SupPid} = machi_flu_sup:start_link(),
try
{ok, _} = machi_flu_psup:start_flu_package(a, 5555, "./data.a",
[{active_mode,false}]),
{ok, _} = machi_flu_psup:start_flu_package(b, 5556, "./data.b",
[{active_mode,false}]),
{ok, _} = machi_flu_psup:start_flu_package(c, 5557, "./data.c",
[{active_mode,false}]),
2015-05-01 05:51:42 +00:00
2015-04-30 14:16:08 +00:00
[begin
2015-05-01 05:51:42 +00:00
_QQ = machi_chain_manager1:test_react_to_env(a_chmgr),
ok
end || _ <- lists:seq(1,5)],
ok
after
2015-05-01 05:51:42 +00:00
exit(SupPid, normal),
machi_util:wait_for_death(SupPid, 100),
ok
end.
-endif. % TEST