mirror of
https://github.com/valitydev/riak_test.git
synced 2024-11-06 08:35:22 +00:00
generate a static scenario ladder
also remove an unused -define
This commit is contained in:
parent
bfae93333c
commit
1daffba3de
@ -19,9 +19,6 @@
|
|||||||
%% -------------------------------------------------------------------
|
%% -------------------------------------------------------------------
|
||||||
-module(ts_cluster_updowngrade_select_aggregation_SUITE).
|
-module(ts_cluster_updowngrade_select_aggregation_SUITE).
|
||||||
|
|
||||||
-ifdef(EQC).
|
|
||||||
-include_lib("eqc/include/eqc.hrl").
|
|
||||||
|
|
||||||
-export([
|
-export([
|
||||||
suite/0,
|
suite/0,
|
||||||
init_per_suite/1,
|
init_per_suite/1,
|
||||||
@ -30,13 +27,9 @@
|
|||||||
run_this_test/1
|
run_this_test/1
|
||||||
]).
|
]).
|
||||||
|
|
||||||
%% EQC exports
|
|
||||||
-export([gen_scenario/0, gen_version/0, prop_scenario/1]).
|
|
||||||
|
|
||||||
-include_lib("common_test/include/ct.hrl").
|
-include_lib("common_test/include/ct.hrl").
|
||||||
-include("ts_updown_util.hrl").
|
-include("ts_updown_util.hrl").
|
||||||
|
|
||||||
-define(TABLE, "updown_aggregation_test_table").
|
|
||||||
-define(TEMPERATURE_COL_INDEX, 4).
|
-define(TEMPERATURE_COL_INDEX, 4).
|
||||||
-define(PRESSURE_COL_INDEX, 5).
|
-define(PRESSURE_COL_INDEX, 5).
|
||||||
-define(PRECIPITATION_COL_INDEX, 6).
|
-define(PRECIPITATION_COL_INDEX, 6).
|
||||||
@ -62,39 +55,27 @@ end_per_suite(Config) ->
|
|||||||
ts_updown_util:maybe_shutdown_client_node(Config).
|
ts_updown_util:maybe_shutdown_client_node(Config).
|
||||||
|
|
||||||
|
|
||||||
%% it's 2 to the power of the number of binary scenario parameters in
|
|
||||||
%% #scenario{} (6)
|
|
||||||
-define(NUMCASES, 64).
|
|
||||||
|
|
||||||
run_this_test(Config) ->
|
run_this_test(Config) ->
|
||||||
case eqc:quickcheck(
|
case ts_updown_util:run_scenarios(Config, make_scenarios()) of
|
||||||
eqc:numtests(?NUMCASES, prop_scenario(Config))) of
|
[] ->
|
||||||
true ->
|
|
||||||
pass;
|
pass;
|
||||||
_ ->
|
_ ->
|
||||||
ct:fail("There were failing queries", [])
|
ct:fail("There were failing queries", [])
|
||||||
end.
|
end.
|
||||||
|
|
||||||
prop_scenario(Config) ->
|
make_scenarios() ->
|
||||||
?FORALL(
|
[#scenario{table_node_vsn = TableNodeVsn,
|
||||||
Sce, gen_scenario(),
|
query_node_vsn = QueryNodeVsn,
|
||||||
[] == ts_updown_util:run_scenario(Config, Sce)).
|
need_table_node_transition = NeedTableNodeTransition,
|
||||||
|
need_query_node_transition = NeedQueryNodeTransition,
|
||||||
gen_scenario() ->
|
need_pre_cluster_mixed = NeedPreClusterMixed,
|
||||||
?LET({TableNodeVsn, QueryNodeVsn,
|
need_post_cluster_mixed = NeedPostClusterMixed}
|
||||||
NeedTableNodeTransition, NeedQueryNodeTransition,
|
|| TableNodeVsn <- [current, previous],
|
||||||
NeedPreClusterMixed, NeedPostClusterMixed},
|
QueryNodeVsn <- [current, previous],
|
||||||
{gen_version(), gen_version(),
|
NeedTableNodeTransition <- [true, false],
|
||||||
bool(), bool(), bool(), bool()},
|
NeedQueryNodeTransition <- [true, false],
|
||||||
#scenario{table_node_vsn = TableNodeVsn,
|
NeedPreClusterMixed <- [true, false],
|
||||||
query_node_vsn = QueryNodeVsn,
|
NeedPostClusterMixed <- [true, false]].
|
||||||
need_table_node_transition = NeedTableNodeTransition,
|
|
||||||
need_query_node_transition = NeedQueryNodeTransition,
|
|
||||||
need_pre_cluster_mixed = NeedPreClusterMixed,
|
|
||||||
need_post_cluster_mixed = NeedPostClusterMixed}).
|
|
||||||
|
|
||||||
gen_version() ->
|
|
||||||
?LET(A, oneof([current, previous]), A).
|
|
||||||
|
|
||||||
|
|
||||||
make_scenario_invariants(Config) ->
|
make_scenario_invariants(Config) ->
|
||||||
@ -102,7 +83,6 @@ make_scenario_invariants(Config) ->
|
|||||||
{SelectVsExpected, Data} = make_queries_and_data(),
|
{SelectVsExpected, Data} = make_queries_and_data(),
|
||||||
Config ++
|
Config ++
|
||||||
[
|
[
|
||||||
{table, <<?TABLE>>},
|
|
||||||
{data, Data},
|
{data, Data},
|
||||||
{ddl, DDL},
|
{ddl, DDL},
|
||||||
{select_vs_expected, SelectVsExpected}
|
{select_vs_expected, SelectVsExpected}
|
||||||
@ -201,5 +181,3 @@ count_non_nulls(Col) ->
|
|||||||
|
|
||||||
stddev_fun_builder(Avg) ->
|
stddev_fun_builder(Avg) ->
|
||||||
fun(X, Acc) -> Acc + (Avg-X)*(Avg-X) end.
|
fun(X, Acc) -> Acc + (Avg-X)*(Avg-X) end.
|
||||||
|
|
||||||
-endif. %% EQC
|
|
||||||
|
Loading…
Reference in New Issue
Block a user