From 75f612a44925a0d5b0704eb8720054a383788588 Mon Sep 17 00:00:00 2001 From: DDDHuang <44492639+DDDHuang@users.noreply.github.com> Date: Thu, 21 Apr 2022 18:30:51 +0800 Subject: [PATCH] fix: bad SUITE & bad code --- apps/emqx_authn/test/emqx_authn_mysql_SUITE.erl | 12 ++++++------ apps/emqx_authz/src/emqx_authz_mysql.erl | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/emqx_authn/test/emqx_authn_mysql_SUITE.erl b/apps/emqx_authn/test/emqx_authn_mysql_SUITE.erl index 93da8ba49..57c5dee16 100644 --- a/apps/emqx_authn/test/emqx_authn_mysql_SUITE.erl +++ b/apps/emqx_authn/test/emqx_authn_mysql_SUITE.erl @@ -24,7 +24,8 @@ -include_lib("eunit/include/eunit.hrl"). -include_lib("common_test/include/ct.hrl"). --define(MYSQL_HOST, "mysql"). +-define(MYSQL_HOST, "192.168.1.234"). +% -define(MYSQL_HOST, "mysql"). -define(MYSQL_RESOURCE, <<"emqx_authn_mysql_SUITE">>). -define(PATH, [authentication]). @@ -198,11 +199,10 @@ t_update(_Config) -> >> }, - %% Code 1146, table not exist - {error, {post_config_update,emqx_authentication, {1146, _, _}}} = - emqx:update_config( - ?PATH, - {create_authenticator, ?GLOBAL, IncorrectConfig}), + {ok, _} = emqx:update_config( + ?PATH, + {create_authenticator, ?GLOBAL, IncorrectConfig} + ), {error, not_authorized} = emqx_access_control:authenticate( #{ diff --git a/apps/emqx_authz/src/emqx_authz_mysql.erl b/apps/emqx_authz/src/emqx_authz_mysql.erl index 1aac2e533..db6acb347 100644 --- a/apps/emqx_authz/src/emqx_authz_mysql.erl +++ b/apps/emqx_authz/src/emqx_authz_mysql.erl @@ -51,7 +51,7 @@ description() -> init(#{query := SQL} = Source0) -> {PrepareSQL, TmplToken} = emqx_authz_utils:parse_sql(SQL, '?', ?PLACEHOLDERS), - Source = Source0#{prepare_statement := #{?MODULE => PrepareSQL}}, + Source = Source0#{prepare_statement => #{?MODULE => PrepareSQL}}, case emqx_authz_utils:create_resource(emqx_connector_mysql, Source) of {error, Reason} -> error({load_config_error, Reason});