riak_test/tests/ts_updown_util.hrl
Gordon Guthrie c20e1f9cba Rejigged updown test suite that tests write and query across a full set of
upgrade/downgrades between a 1.3 and a 1.4 cluster
2016-08-03 14:46:46 +00:00

121 lines
3.6 KiB
Erlang

%% -------------------------------------------------------------------
%%
%% Copyright (c) 2016 Basho Technologies, Inc.
%%
%% 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.
%%
%% -------------------------------------------------------------------
-ifndef(TS_UPDOWN_UTIL_HRL).
-define(TS_UPDOWN_UTIL_HRL, included).
-define(CFG(K, C), proplists:get_value(K, C)).
-type cell() :: integer() | float() | binary() | boolean().
-type row() :: [cell()].
-type config() :: proplists:proplist().
-type version() :: current | previous.
-record(create, {
should_skip = false :: boolean(),
ddl :: binary,
expected :: term()
}).
-record(insert, {
should_skip = false :: boolean(),
%% A list of data to write to the table
data :: [row()],
expected :: term()
}).
-record(select, {
should_skip = false :: boolean(),
%% the select query is an io_lib:format containing a single "~s" placeholder
%% for the table name
qry :: binary(),
expected :: term(),
assert_mod :: atom(),
assert_fun :: atom()
}).
-record(test_set, {
testname :: string(),
create :: #create{},
insert :: #insert{},
selects = [] :: [#select{}],
timestamp :: string()
}).
%% Scenario description and requirements
-record(scenario, {
%% riak version on the node where CREATE TABLE query will be issued
table_node_vsn :: version(),
%% riak version on the node where SELECT queries will be issued
query_node_vsn :: version(),
%% whether to up- or downgrade the interesting nodes after
%% table creation (before running SELECT queries)
need_table_node_transition :: boolean(),
need_query_node_transition :: boolean(),
%% hints to try to ensure cluster homogeneity after any node
%% transitions (may not be honoured depending on whether the
%% interesting nodes emerge in different or same version
%% after transitions)
need_pre_cluster_mixed :: boolean(),
need_post_cluster_mixed :: boolean(),
tests = [] :: [#test_set{}]
}).
%% fail record
-record(fail, {
message :: binary(),
expected :: term(),
got :: term()
}).
%% Error report
-record(failure_report, {
%% node composition, with versions at each node
cluster :: [{node(), version()}],
%% node where table was created
table_node :: node(),
%% node where the failing SELECT was issued
query_node :: node(),
%% whether the table and querying nodes were upgraded or
%% downgraded prior to SELECT query
did_transition_table_node :: boolean(),
did_transition_query_node :: boolean(),
%% the failing test proper
failing_test :: binary(),
%% Expected and Got
expected :: term(),
error :: term()
}).
-endif.