2015-08-25 10:12:23 +00:00
|
|
|
%% -------------------------------------------------------------------
|
|
|
|
%%
|
|
|
|
%% 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.
|
|
|
|
%%
|
|
|
|
%% -------------------------------------------------------------------
|
|
|
|
|
|
|
|
-module(machi_projection_store_test).
|
|
|
|
|
|
|
|
-ifdef(TEST).
|
|
|
|
-ifndef(PULSE).
|
|
|
|
|
|
|
|
-compile(export_all).
|
|
|
|
-define(PS, machi_projection_store).
|
|
|
|
|
|
|
|
-include("machi_projection.hrl").
|
|
|
|
|
|
|
|
smoke_test() ->
|
|
|
|
PortBase = 64820,
|
|
|
|
Dir = "./data.a",
|
|
|
|
Os = [{ignore_stability_time, true}, {active_mode, false}],
|
|
|
|
os:cmd("rm -rf " ++ Dir),
|
2015-12-07 06:26:39 +00:00
|
|
|
machi_test_util:start_flu_package(a, PortBase, "./data.a", Os),
|
2015-08-25 10:12:23 +00:00
|
|
|
|
|
|
|
try
|
|
|
|
P1 = machi_projection:new(1, a, [], [], [], [], []),
|
|
|
|
ok = ?PS:write(a_pstore, public, P1),
|
|
|
|
{error, written} = ?PS:write(a_pstore, public, P1),
|
|
|
|
|
2015-08-25 10:31:05 +00:00
|
|
|
Pbad = P1#projection_v1{epoch_number=99238}, % break checksum
|
|
|
|
{error, bad_arg} = ?PS:write(a_pstore, public, Pbad),
|
|
|
|
|
2015-08-25 10:12:23 +00:00
|
|
|
ok = ?PS:write(a_pstore, private, P1),
|
2015-08-25 10:42:33 +00:00
|
|
|
P1a = machi_projection:update_checksum(P1#projection_v1{dbg=[diff_yo]}),
|
|
|
|
{error, written} = ?PS:write(a_pstore, private, P1a),
|
|
|
|
|
2015-08-25 10:12:23 +00:00
|
|
|
P1b = P1#projection_v1{dbg2=[version_b]},
|
|
|
|
ok = ?PS:write(a_pstore, private, P1b),
|
|
|
|
P1c = P1#projection_v1{dbg2=[version_c]},
|
|
|
|
ok = ?PS:write(a_pstore, private, P1c),
|
2015-08-25 10:42:33 +00:00
|
|
|
{error, written} = ?PS:write(a_pstore, private, P1a),
|
2015-08-25 10:12:23 +00:00
|
|
|
|
2015-08-26 05:54:01 +00:00
|
|
|
ok = ?PS:set_consistency_mode(a_pstore, ap_mode),
|
|
|
|
ok = ?PS:set_consistency_mode(a_pstore, cp_mode),
|
|
|
|
|
2015-08-25 10:12:23 +00:00
|
|
|
ok
|
|
|
|
after
|
2015-12-07 06:26:39 +00:00
|
|
|
machi_test_util:stop_flu_package()
|
2015-08-25 10:12:23 +00:00
|
|
|
end.
|
|
|
|
|
|
|
|
-endif. % !PULSE
|
|
|
|
-endif. % TEST
|