test(ds): avoid introducing new macros
This commit is contained in:
parent
69427dc42d
commit
f7e3afde16
|
@ -83,27 +83,6 @@
|
||||||
end)()
|
end)()
|
||||||
).
|
).
|
||||||
|
|
||||||
-define(assertMatchOneOf(PAT1, PAT2, EXPR),
|
|
||||||
(fun() ->
|
|
||||||
case (X__V = (EXPR)) of
|
|
||||||
PAT1 ->
|
|
||||||
X__V;
|
|
||||||
PAT2 ->
|
|
||||||
X__V;
|
|
||||||
_ ->
|
|
||||||
erlang:error(
|
|
||||||
{assertMatch, [
|
|
||||||
{module, ?MODULE},
|
|
||||||
{line, ?LINE},
|
|
||||||
{expression, (??EXPR)},
|
|
||||||
{pattern, "one of [ " ++ (??PAT1) ++ ", " ++ (??PAT2) ++ " ]"},
|
|
||||||
{value, X__V}
|
|
||||||
]}
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end)()
|
|
||||||
).
|
|
||||||
|
|
||||||
-define(assertExceptionOneOf(CT1, CT2, EXPR),
|
-define(assertExceptionOneOf(CT1, CT2, EXPR),
|
||||||
(fun() ->
|
(fun() ->
|
||||||
X__Attrs = [
|
X__Attrs = [
|
||||||
|
|
|
@ -610,11 +610,14 @@ t_error_mapping_replication_layer(_Config) ->
|
||||||
%% At least one of `emqx_ds:make_iterator/4` will end in an error.
|
%% At least one of `emqx_ds:make_iterator/4` will end in an error.
|
||||||
Results1 = lists:map(
|
Results1 = lists:map(
|
||||||
fun({_Rank, S}) ->
|
fun({_Rank, S}) ->
|
||||||
?assertMatchOneOf(
|
case emqx_ds:make_iterator(DB, S, TopicFilter, 0) of
|
||||||
{ok, _Iter},
|
Ok = {ok, _Iter} ->
|
||||||
{error, recoverable, {erpc, _}},
|
Ok;
|
||||||
emqx_ds:make_iterator(DB, S, TopicFilter, 0)
|
Error = {error, recoverable, {erpc, _}} ->
|
||||||
)
|
Error;
|
||||||
|
Other ->
|
||||||
|
ct:fail({unexpected_result, Other})
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
Streams0
|
Streams0
|
||||||
),
|
),
|
||||||
|
@ -626,11 +629,14 @@ t_error_mapping_replication_layer(_Config) ->
|
||||||
%% At least one of `emqx_ds:next/3` over initial set of iterators will end in an error.
|
%% At least one of `emqx_ds:next/3` over initial set of iterators will end in an error.
|
||||||
Results2 = lists:map(
|
Results2 = lists:map(
|
||||||
fun(Iter) ->
|
fun(Iter) ->
|
||||||
?assertMatchOneOf(
|
case emqx_ds:next(DB, Iter, _BatchSize = 42) of
|
||||||
{ok, _Iter, [_ | _]},
|
Ok = {ok, _Iter, [_ | _]} ->
|
||||||
{error, recoverable, {badrpc, _}},
|
Ok;
|
||||||
emqx_ds:next(DB, Iter, _BatchSize = 42)
|
Error = {error, recoverable, {badrpc, _}} ->
|
||||||
)
|
Error;
|
||||||
|
Other ->
|
||||||
|
ct:fail({unexpected_result, Other})
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
Iterators0
|
Iterators0
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in New Issue