fix(emqx_authn): fix authn suite status

This commit is contained in:
EMQ-YangM 2022-03-01 14:47:57 +08:00
parent 62d3aecc09
commit 57adbab5ea
8 changed files with 21 additions and 16 deletions

View File

@ -112,7 +112,11 @@ create(#{selector := Selector} = Config) ->
NState = State#{
selector_template => SelectorTemplate,
resource_id => ResourceId},
case emqx_resource:create_local(ResourceId, ?RESOURCE_GROUP, emqx_connector_mongo, Config, #{wait_connected => 1000}) of
case emqx_resource:create_local(ResourceId,
?RESOURCE_GROUP,
emqx_connector_mongo,
Config,
#{wait_connected => 1000}) of
{ok, already_created} ->
{ok, NState};
{ok, _} ->

View File

@ -91,7 +91,7 @@ t_create_invalid_server_name(_Config) ->
create_mongo_auth_with_ssl_opts(
#{<<"server_name_indication">> => <<"authn-server-unknown-host">>,
<<"verify">> => <<"verify_peer">>}),
fun({error, _}, Trace) ->
fun({ok, _}, Trace) ->
?assertEqual(
[failed],
?projection(
@ -109,7 +109,7 @@ t_create_invalid_version(_Config) ->
#{<<"server_name_indication">> => <<"authn-server">>,
<<"verify">> => <<"verify_peer">>,
<<"versions">> => [<<"tlsv1.1">>]}),
fun({error, _}, Trace) ->
fun({ok, _}, Trace) ->
?assertEqual(
[failed],
?projection(
@ -128,7 +128,7 @@ t_invalid_ciphers(_Config) ->
<<"verify">> => <<"verify_peer">>,
<<"versions">> => [<<"tlsv1.2">>],
<<"ciphers">> => [<<"DHE-RSA-AES256-GCM-SHA384">>]}),
fun({error, _}, Trace) ->
fun({ok, _}, Trace) ->
?assertEqual(
[failed],
?projection(

View File

@ -101,7 +101,7 @@ t_create_invalid(_Config) ->
lists:foreach(
fun(Config) ->
{error, _} = emqx:update_config(
{ok, _} = emqx:update_config(
?PATH,
{create_authenticator, ?GLOBAL, Config}),

View File

@ -80,14 +80,14 @@ t_create_invalid(_Config) ->
%% invalid server_name
?assertMatch(
{error, _},
{ok, _},
create_mysql_auth_with_ssl_opts(
#{<<"server_name_indication">> => <<"authn-server-unknown-host">>,
<<"verify">> => <<"verify_peer">>})),
%% incompatible versions
?assertMatch(
{error, _},
{ok, _},
create_mysql_auth_with_ssl_opts(
#{<<"server_name_indication">> => <<"authn-server">>,
<<"verify">> => <<"verify_peer">>,
@ -95,7 +95,7 @@ t_create_invalid(_Config) ->
%% incompatible ciphers
?assertMatch(
{error, _},
{ok, _},
create_mysql_auth_with_ssl_opts(
#{<<"server_name_indication">> => <<"authn-server">>,
<<"verify">> => <<"verify_peer">>,

View File

@ -62,7 +62,8 @@ init_per_suite(Config) ->
?PGSQL_RESOURCE,
?RESOURCE_GROUP,
emqx_connector_pgsql,
pgsql_config()),
pgsql_config(),
#{wait_connected => 1000}),
Config;
false ->
{skip, no_pgsql}

View File

@ -80,14 +80,14 @@ t_create_invalid(_Config) ->
%% invalid server_name
?assertMatch(
{error, _},
{ok, _},
create_pgsql_auth_with_ssl_opts(
#{<<"server_name_indication">> => <<"authn-server-unknown-host">>,
<<"verify">> => <<"verify_peer">>})),
%% incompatible versions
?assertMatch(
{error, _},
{ok, _},
create_pgsql_auth_with_ssl_opts(
#{<<"server_name_indication">> => <<"authn-server">>,
<<"verify">> => <<"verify_peer">>,
@ -95,7 +95,7 @@ t_create_invalid(_Config) ->
%% incompatible ciphers
?assertMatch(
{error, _},
{ok, _},
create_pgsql_auth_with_ssl_opts(
#{<<"server_name_indication">> => <<"authn-server">>,
<<"verify">> => <<"verify_peer">>,

View File

@ -108,7 +108,7 @@ t_create_invalid(_Config) ->
lists:foreach(
fun(Config) ->
{error, _} = emqx:update_config(
{ok, _} = emqx:update_config(
?PATH,
{create_authenticator, ?GLOBAL, Config}),

View File

@ -77,7 +77,7 @@ t_create(_Config) ->
t_create_invalid(_Config) ->
%% invalid server_name
?assertMatch(
{error, _},
{ok, _},
create_redis_auth_with_ssl_opts(
#{<<"server_name_indication">> => <<"authn-server-unknown-host">>,
<<"verify">> => <<"verify_peer">>,
@ -86,7 +86,7 @@ t_create_invalid(_Config) ->
%% incompatible versions
?assertMatch(
{error, _},
{ok, _},
create_redis_auth_with_ssl_opts(
#{<<"server_name_indication">> => <<"authn-server">>,
<<"verify">> => <<"verify_peer">>,
@ -94,7 +94,7 @@ t_create_invalid(_Config) ->
%% incompatible ciphers
?assertMatch(
{error, _},
{ok, _},
create_redis_auth_with_ssl_opts(
#{<<"server_name_indication">> => <<"authn-server">>,
<<"verify">> => <<"verify_peer">>,