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.
|
boolean(Other) -> Other.
|
||||||
|
|
||||||
select_ref(true, _) ->
|
select_ref(true, _) ->
|
||||||
[hoconsc:ref(?MODULE, 'jwks')];
|
[hoconsc:ref(?MODULE, 'jwt_jwks')];
|
||||||
select_ref(false, #{<<"public_key">> := _}) ->
|
select_ref(false, #{<<"public_key">> := _}) ->
|
||||||
[hoconsc:ref(?MODULE, jwt_public_key)];
|
[hoconsc:ref(?MODULE, jwt_public_key)];
|
||||||
select_ref(false, _) ->
|
select_ref(false, _) ->
|
||||||
|
|
|
@ -32,19 +32,19 @@ union_member_selector_mongo_test_() ->
|
||||||
end},
|
end},
|
||||||
{"single", fun() ->
|
{"single", fun() ->
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
?ERR(#{matched_type := "authn:redis_single"}),
|
?ERR(#{matched_type := "authn:mongo_single"}),
|
||||||
Check("{mongo_type: single}")
|
Check("{mongo_type: single}")
|
||||||
)
|
)
|
||||||
end},
|
end},
|
||||||
{"replica-set", fun() ->
|
{"replica-set", fun() ->
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
?ERR(#{matched_type := "authn-mongodb:replica-set"}),
|
?ERR(#{matched_type := "authn:mongo_rs"}),
|
||||||
Check("{mongo_type: rs}")
|
Check("{mongo_type: rs}")
|
||||||
)
|
)
|
||||||
end},
|
end},
|
||||||
{"sharded", fun() ->
|
{"sharded", fun() ->
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
?ERR(#{matched_type := "authn-mongodb:sharded-cluster"}),
|
?ERR(#{matched_type := "authn:mongo_sharded"}),
|
||||||
Check("{mongo_type: sharded}")
|
Check("{mongo_type: sharded}")
|
||||||
)
|
)
|
||||||
end}
|
end}
|
||||||
|
@ -61,19 +61,19 @@ union_member_selector_jwt_test_() ->
|
||||||
end},
|
end},
|
||||||
{"jwks", fun() ->
|
{"jwks", fun() ->
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
?ERR(#{matched_type := "authn-jwt:jwks"}),
|
?ERR(#{matched_type := "authn:jwt_jwks"}),
|
||||||
Check("{use_jwks = true}")
|
Check("{use_jwks = true}")
|
||||||
)
|
)
|
||||||
end},
|
end},
|
||||||
{"publick-key", fun() ->
|
{"publick-key", fun() ->
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
?ERR(#{matched_type := "authn-jwt:public-key"}),
|
?ERR(#{matched_type := "authn:jwt_public_key"}),
|
||||||
Check("{use_jwks = false, public_key = 1}")
|
Check("{use_jwks = false, public_key = 1}")
|
||||||
)
|
)
|
||||||
end},
|
end},
|
||||||
{"hmac-based", fun() ->
|
{"hmac-based", fun() ->
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
?ERR(#{matched_type := "authn-jwt:hmac-based"}),
|
?ERR(#{matched_type := "authn:jwt_hmac"}),
|
||||||
Check("{use_jwks = false}")
|
Check("{use_jwks = false}")
|
||||||
)
|
)
|
||||||
end}
|
end}
|
||||||
|
@ -90,19 +90,19 @@ union_member_selector_redis_test_() ->
|
||||||
end},
|
end},
|
||||||
{"single", fun() ->
|
{"single", fun() ->
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
?ERR(#{matched_type := "authn-redis:standalone"}),
|
?ERR(#{matched_type := "authn:redis_single"}),
|
||||||
Check("{redis_type = single}")
|
Check("{redis_type = single}")
|
||||||
)
|
)
|
||||||
end},
|
end},
|
||||||
{"cluster", fun() ->
|
{"cluster", fun() ->
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
?ERR(#{matched_type := "authn-redis:cluster"}),
|
?ERR(#{matched_type := "authn:redis_cluster"}),
|
||||||
Check("{redis_type = cluster}")
|
Check("{redis_type = cluster}")
|
||||||
)
|
)
|
||||||
end},
|
end},
|
||||||
{"sentinel", fun() ->
|
{"sentinel", fun() ->
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
?ERR(#{matched_type := "authn-redis:sentinel"}),
|
?ERR(#{matched_type := "authn:redis_sentinel"}),
|
||||||
Check("{redis_type = sentinel}")
|
Check("{redis_type = sentinel}")
|
||||||
)
|
)
|
||||||
end}
|
end}
|
||||||
|
@ -119,13 +119,13 @@ union_member_selector_http_test_() ->
|
||||||
end},
|
end},
|
||||||
{"get", fun() ->
|
{"get", fun() ->
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
?ERR(#{matched_type := "authn-http:get"}),
|
?ERR(#{matched_type := "authn:http_get"}),
|
||||||
Check("{method = get}")
|
Check("{method = get}")
|
||||||
)
|
)
|
||||||
end},
|
end},
|
||||||
{"post", fun() ->
|
{"post", fun() ->
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
?ERR(#{matched_type := "authn-http:post"}),
|
?ERR(#{matched_type := "authn:http_post"}),
|
||||||
Check("{method = post}")
|
Check("{method = post}")
|
||||||
)
|
)
|
||||||
end}
|
end}
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
|
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
|
|
||||||
-import(emqx_ee_bridge_influxdb, [to_influx_lines/1]).
|
|
||||||
|
|
||||||
-define(INVALID_LINES, [
|
-define(INVALID_LINES, [
|
||||||
" ",
|
" ",
|
||||||
" \n",
|
" \n",
|
||||||
|
@ -326,3 +324,13 @@ test_pairs(PairsList) ->
|
||||||
|
|
||||||
join(Sep, LinesList) ->
|
join(Sep, LinesList) ->
|
||||||
lists:flatten(lists: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