2016-07-15 01:11:34 +00:00
|
|
|
%% -------------------------------------------------------------------
|
|
|
|
%%
|
|
|
|
%% 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().
|
2016-07-29 08:19:15 +00:00
|
|
|
-type row() :: [cell()].
|
2016-07-15 01:11:34 +00:00
|
|
|
|
2016-07-29 08:19:15 +00:00
|
|
|
-type config() :: proplists:proplist().
|
2016-07-15 01:11:34 +00:00
|
|
|
-type version() :: current | previous.
|
|
|
|
|
2016-11-01 00:29:16 +00:00
|
|
|
-type cap_with_ver() :: {{atom(), atom()}, term()}.
|
|
|
|
|
2016-07-29 08:19:15 +00:00
|
|
|
-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(),
|
2016-10-29 16:13:47 +00:00
|
|
|
%% the select query is an io_lib:format containing a single "~s" placeholder
|
2016-07-29 08:19:15 +00:00
|
|
|
%% for the table name
|
2016-08-03 14:46:46 +00:00
|
|
|
qry :: binary(),
|
|
|
|
expected :: term(),
|
|
|
|
assert_mod :: atom(),
|
|
|
|
assert_fun :: atom()
|
2016-07-29 08:19:15 +00:00
|
|
|
}).
|
|
|
|
|
|
|
|
-record(test_set, {
|
2016-07-29 13:24:30 +00:00
|
|
|
testname :: string(),
|
2016-07-29 08:19:15 +00:00
|
|
|
create :: #create{},
|
|
|
|
insert :: #insert{},
|
|
|
|
selects = [] :: [#select{}],
|
|
|
|
timestamp :: string()
|
|
|
|
}).
|
|
|
|
|
2016-07-18 01:27:19 +00:00
|
|
|
%% Scenario description and requirements
|
2016-07-15 01:11:34 +00:00
|
|
|
-record(scenario, {
|
2016-07-18 01:27:19 +00:00
|
|
|
%% riak version on the node where CREATE TABLE query will be issued
|
2016-07-15 01:11:34 +00:00
|
|
|
table_node_vsn :: version(),
|
2016-07-18 01:27:19 +00:00
|
|
|
|
|
|
|
%% riak version on the node where SELECT queries will be issued
|
2016-07-15 01:11:34 +00:00
|
|
|
query_node_vsn :: version(),
|
2016-07-18 01:27:19 +00:00
|
|
|
|
|
|
|
%% whether to up- or downgrade the interesting nodes after
|
|
|
|
%% table creation (before running SELECT queries)
|
2016-07-15 01:11:34 +00:00
|
|
|
need_table_node_transition :: boolean(),
|
|
|
|
need_query_node_transition :: boolean(),
|
2016-07-18 01:27:19 +00:00
|
|
|
|
|
|
|
%% 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)
|
2016-07-15 01:11:34 +00:00
|
|
|
need_pre_cluster_mixed :: boolean(),
|
|
|
|
need_post_cluster_mixed :: boolean(),
|
2016-07-18 01:27:19 +00:00
|
|
|
|
2016-10-29 16:13:47 +00:00
|
|
|
tests = [] :: [#test_set{}],
|
|
|
|
|
|
|
|
%% in case riak.conf generated for one version needs tweaked
|
|
|
|
%% to be understood by the other, use these functions
|
|
|
|
convert_config_to_previous = fun(_) -> ok end :: function(),
|
2016-11-01 00:29:16 +00:00
|
|
|
convert_config_to_current = fun(_) -> ok end :: function(),
|
|
|
|
|
|
|
|
%% list of capability-version pairs, to wait until
|
|
|
|
%% propagation thereof, before issuing a query
|
|
|
|
%% - when the cluster is fully upgraded:
|
|
|
|
ensure_full_caps = [] :: [cap_with_ver()],
|
|
|
|
%% - when the cluster is mixed or fully downgraded:
|
|
|
|
ensure_degraded_caps = [] :: [cap_with_ver()]
|
2016-07-29 08:19:15 +00:00
|
|
|
}).
|
2016-07-25 23:30:30 +00:00
|
|
|
|
2016-07-18 01:27:19 +00:00
|
|
|
%% Error report
|
2016-07-15 01:11:34 +00:00
|
|
|
-record(failure_report, {
|
2016-11-06 04:20:25 +00:00
|
|
|
cluster :: [{node(), version()}],
|
2016-07-18 01:27:19 +00:00
|
|
|
%% node where table was created
|
2016-07-15 01:11:34 +00:00
|
|
|
table_node :: node(),
|
2016-07-18 01:27:19 +00:00
|
|
|
%% node where the failing SELECT was issued
|
2016-07-15 01:11:34 +00:00
|
|
|
query_node :: node(),
|
2016-07-18 01:27:19 +00:00
|
|
|
|
2016-07-29 08:19:15 +00:00
|
|
|
%% the failing test proper
|
|
|
|
failing_test :: binary(),
|
2016-07-18 01:27:19 +00:00
|
|
|
|
|
|
|
%% Expected and Got
|
2016-11-06 04:20:25 +00:00
|
|
|
message :: binary(),
|
2016-07-15 01:11:34 +00:00
|
|
|
expected :: term(),
|
2016-11-06 04:20:25 +00:00
|
|
|
got :: term()
|
2016-07-15 01:11:34 +00:00
|
|
|
}).
|
|
|
|
|
|
|
|
-endif.
|