test: fix unit tests after type names changed
This commit is contained in:
parent
48d8381a6d
commit
cd1197925f
|
@ -200,7 +200,7 @@ boolean(<<"false">>) -> false;
|
|||
boolean(Other) -> Other.
|
||||
|
||||
select_ref(true, _) ->
|
||||
[hoconsc:ref(?MODULE, 'jwks')];
|
||||
[hoconsc:ref(?MODULE, 'jwt_jwks')];
|
||||
select_ref(false, #{<<"public_key">> := _}) ->
|
||||
[hoconsc:ref(?MODULE, jwt_public_key)];
|
||||
select_ref(false, _) ->
|
||||
|
|
|
@ -32,19 +32,19 @@ union_member_selector_mongo_test_() ->
|
|||
end},
|
||||
{"single", fun() ->
|
||||
?assertMatch(
|
||||
?ERR(#{matched_type := "authn:redis_single"}),
|
||||
?ERR(#{matched_type := "authn:mongo_single"}),
|
||||
Check("{mongo_type: single}")
|
||||
)
|
||||
end},
|
||||
{"replica-set", fun() ->
|
||||
?assertMatch(
|
||||
?ERR(#{matched_type := "authn-mongodb:replica-set"}),
|
||||
?ERR(#{matched_type := "authn:mongo_rs"}),
|
||||
Check("{mongo_type: rs}")
|
||||
)
|
||||
end},
|
||||
{"sharded", fun() ->
|
||||
?assertMatch(
|
||||
?ERR(#{matched_type := "authn-mongodb:sharded-cluster"}),
|
||||
?ERR(#{matched_type := "authn:mongo_sharded"}),
|
||||
Check("{mongo_type: sharded}")
|
||||
)
|
||||
end}
|
||||
|
@ -61,19 +61,19 @@ union_member_selector_jwt_test_() ->
|
|||
end},
|
||||
{"jwks", fun() ->
|
||||
?assertMatch(
|
||||
?ERR(#{matched_type := "authn-jwt:jwks"}),
|
||||
?ERR(#{matched_type := "authn:jwt_jwks"}),
|
||||
Check("{use_jwks = true}")
|
||||
)
|
||||
end},
|
||||
{"publick-key", fun() ->
|
||||
?assertMatch(
|
||||
?ERR(#{matched_type := "authn-jwt:public-key"}),
|
||||
?ERR(#{matched_type := "authn:jwt_public_key"}),
|
||||
Check("{use_jwks = false, public_key = 1}")
|
||||
)
|
||||
end},
|
||||
{"hmac-based", fun() ->
|
||||
?assertMatch(
|
||||
?ERR(#{matched_type := "authn-jwt:hmac-based"}),
|
||||
?ERR(#{matched_type := "authn:jwt_hmac"}),
|
||||
Check("{use_jwks = false}")
|
||||
)
|
||||
end}
|
||||
|
@ -90,19 +90,19 @@ union_member_selector_redis_test_() ->
|
|||
end},
|
||||
{"single", fun() ->
|
||||
?assertMatch(
|
||||
?ERR(#{matched_type := "authn-redis:standalone"}),
|
||||
?ERR(#{matched_type := "authn:redis_single"}),
|
||||
Check("{redis_type = single}")
|
||||
)
|
||||
end},
|
||||
{"cluster", fun() ->
|
||||
?assertMatch(
|
||||
?ERR(#{matched_type := "authn-redis:cluster"}),
|
||||
?ERR(#{matched_type := "authn:redis_cluster"}),
|
||||
Check("{redis_type = cluster}")
|
||||
)
|
||||
end},
|
||||
{"sentinel", fun() ->
|
||||
?assertMatch(
|
||||
?ERR(#{matched_type := "authn-redis:sentinel"}),
|
||||
?ERR(#{matched_type := "authn:redis_sentinel"}),
|
||||
Check("{redis_type = sentinel}")
|
||||
)
|
||||
end}
|
||||
|
@ -119,13 +119,13 @@ union_member_selector_http_test_() ->
|
|||
end},
|
||||
{"get", fun() ->
|
||||
?assertMatch(
|
||||
?ERR(#{matched_type := "authn-http:get"}),
|
||||
?ERR(#{matched_type := "authn:http_get"}),
|
||||
Check("{method = get}")
|
||||
)
|
||||
end},
|
||||
{"post", fun() ->
|
||||
?assertMatch(
|
||||
?ERR(#{matched_type := "authn-http:post"}),
|
||||
?ERR(#{matched_type := "authn:http_post"}),
|
||||
Check("{method = post}")
|
||||
)
|
||||
end}
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
|
||||
-include_lib("eunit/include/eunit.hrl").
|
||||
|
||||
-import(emqx_ee_bridge_influxdb, [to_influx_lines/1]).
|
||||
|
||||
-define(INVALID_LINES, [
|
||||
" ",
|
||||
" \n",
|
||||
|
@ -326,3 +324,13 @@ test_pairs(PairsList) ->
|
|||
|
||||
join(Sep, LinesList) ->
|
||||
lists:flatten(lists:join(Sep, LinesList)).
|
||||
|
||||
to_influx_lines(RawLines) ->
|
||||
OldLevel = emqx_logger:get_primary_log_level(),
|
||||
try
|
||||
%% mute error logs from this call
|
||||
emqx_logger:set_primary_log_level(none),
|
||||
emqx_ee_bridge_influxdb:to_influx_lines(RawLines)
|
||||
after
|
||||
emqx_logger:set_primary_log_level(OldLevel)
|
||||
end.
|
||||
|
|
Loading…
Reference in New Issue