From 57adbab5eadf89828e0a312e91f8a1048f8d4044 Mon Sep 17 00:00:00 2001 From: EMQ-YangM Date: Tue, 1 Mar 2022 14:47:57 +0800 Subject: [PATCH] fix(emqx_authn): fix authn suite status --- apps/emqx_authn/src/simple_authn/emqx_authn_mongodb.erl | 6 +++++- apps/emqx_authn/test/emqx_authn_mongo_tls_SUITE.erl | 6 +++--- apps/emqx_authn/test/emqx_authn_mysql_SUITE.erl | 2 +- apps/emqx_authn/test/emqx_authn_mysql_tls_SUITE.erl | 6 +++--- apps/emqx_authn/test/emqx_authn_pgsql_SUITE.erl | 3 ++- apps/emqx_authn/test/emqx_authn_pgsql_tls_SUITE.erl | 6 +++--- apps/emqx_authn/test/emqx_authn_redis_SUITE.erl | 2 +- apps/emqx_authn/test/emqx_authn_redis_tls_SUITE.erl | 6 +++--- 8 files changed, 21 insertions(+), 16 deletions(-) diff --git a/apps/emqx_authn/src/simple_authn/emqx_authn_mongodb.erl b/apps/emqx_authn/src/simple_authn/emqx_authn_mongodb.erl index 10e5d370c..fc444d6f2 100644 --- a/apps/emqx_authn/src/simple_authn/emqx_authn_mongodb.erl +++ b/apps/emqx_authn/src/simple_authn/emqx_authn_mongodb.erl @@ -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, _} -> diff --git a/apps/emqx_authn/test/emqx_authn_mongo_tls_SUITE.erl b/apps/emqx_authn/test/emqx_authn_mongo_tls_SUITE.erl index 0e36d125c..c471c1f8b 100644 --- a/apps/emqx_authn/test/emqx_authn_mongo_tls_SUITE.erl +++ b/apps/emqx_authn/test/emqx_authn_mongo_tls_SUITE.erl @@ -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( diff --git a/apps/emqx_authn/test/emqx_authn_mysql_SUITE.erl b/apps/emqx_authn/test/emqx_authn_mysql_SUITE.erl index 56e1b491e..b2a69b4c8 100644 --- a/apps/emqx_authn/test/emqx_authn_mysql_SUITE.erl +++ b/apps/emqx_authn/test/emqx_authn_mysql_SUITE.erl @@ -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}), diff --git a/apps/emqx_authn/test/emqx_authn_mysql_tls_SUITE.erl b/apps/emqx_authn/test/emqx_authn_mysql_tls_SUITE.erl index a919c91c9..ce9e04577 100644 --- a/apps/emqx_authn/test/emqx_authn_mysql_tls_SUITE.erl +++ b/apps/emqx_authn/test/emqx_authn_mysql_tls_SUITE.erl @@ -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">>, diff --git a/apps/emqx_authn/test/emqx_authn_pgsql_SUITE.erl b/apps/emqx_authn/test/emqx_authn_pgsql_SUITE.erl index 3bf93dc09..fecd3d6a4 100644 --- a/apps/emqx_authn/test/emqx_authn_pgsql_SUITE.erl +++ b/apps/emqx_authn/test/emqx_authn_pgsql_SUITE.erl @@ -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} diff --git a/apps/emqx_authn/test/emqx_authn_pgsql_tls_SUITE.erl b/apps/emqx_authn/test/emqx_authn_pgsql_tls_SUITE.erl index 72c4a3126..0c21badc9 100644 --- a/apps/emqx_authn/test/emqx_authn_pgsql_tls_SUITE.erl +++ b/apps/emqx_authn/test/emqx_authn_pgsql_tls_SUITE.erl @@ -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">>, diff --git a/apps/emqx_authn/test/emqx_authn_redis_SUITE.erl b/apps/emqx_authn/test/emqx_authn_redis_SUITE.erl index 0645bfd7d..7aad87b6a 100644 --- a/apps/emqx_authn/test/emqx_authn_redis_SUITE.erl +++ b/apps/emqx_authn/test/emqx_authn_redis_SUITE.erl @@ -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}), diff --git a/apps/emqx_authn/test/emqx_authn_redis_tls_SUITE.erl b/apps/emqx_authn/test/emqx_authn_redis_tls_SUITE.erl index b3f456622..d6249e328 100644 --- a/apps/emqx_authn/test/emqx_authn_redis_tls_SUITE.erl +++ b/apps/emqx_authn/test/emqx_authn_redis_tls_SUITE.erl @@ -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">>,