diff --git a/apps/emqx/include/asserts.hrl b/apps/emqx/include/asserts.hrl index 5744fdbf3..a200394e4 100644 --- a/apps/emqx/include/asserts.hrl +++ b/apps/emqx/include/asserts.hrl @@ -83,27 +83,6 @@ 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), (fun() -> X__Attrs = [ diff --git a/apps/emqx_durable_storage/test/emqx_ds_SUITE.erl b/apps/emqx_durable_storage/test/emqx_ds_SUITE.erl index 002f5c557..5ba616012 100644 --- a/apps/emqx_durable_storage/test/emqx_ds_SUITE.erl +++ b/apps/emqx_durable_storage/test/emqx_ds_SUITE.erl @@ -610,11 +610,14 @@ t_error_mapping_replication_layer(_Config) -> %% At least one of `emqx_ds:make_iterator/4` will end in an error. Results1 = lists:map( fun({_Rank, S}) -> - ?assertMatchOneOf( - {ok, _Iter}, - {error, recoverable, {erpc, _}}, - emqx_ds:make_iterator(DB, S, TopicFilter, 0) - ) + case emqx_ds:make_iterator(DB, S, TopicFilter, 0) of + Ok = {ok, _Iter} -> + Ok; + Error = {error, recoverable, {erpc, _}} -> + Error; + Other -> + ct:fail({unexpected_result, Other}) + end end, 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. Results2 = lists:map( fun(Iter) -> - ?assertMatchOneOf( - {ok, _Iter, [_ | _]}, - {error, recoverable, {badrpc, _}}, - emqx_ds:next(DB, Iter, _BatchSize = 42) - ) + case emqx_ds:next(DB, Iter, _BatchSize = 42) of + Ok = {ok, _Iter, [_ | _]} -> + Ok; + Error = {error, recoverable, {badrpc, _}} -> + Error; + Other -> + ct:fail({unexpected_result, Other}) + end end, Iterators0 ),