fix: bad SUITE & bad code

This commit is contained in:
DDDHuang 2022-04-21 18:30:51 +08:00
parent 7417e5070d
commit 75f612a449
2 changed files with 7 additions and 7 deletions

View File

@ -24,7 +24,8 @@
-include_lib("eunit/include/eunit.hrl"). -include_lib("eunit/include/eunit.hrl").
-include_lib("common_test/include/ct.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(MYSQL_RESOURCE, <<"emqx_authn_mysql_SUITE">>).
-define(PATH, [authentication]). -define(PATH, [authentication]).
@ -198,11 +199,10 @@ t_update(_Config) ->
>> >>
}, },
%% Code 1146, table not exist {ok, _} = emqx:update_config(
{error, {post_config_update,emqx_authentication, {1146, _, _}}} = ?PATH,
emqx:update_config( {create_authenticator, ?GLOBAL, IncorrectConfig}
?PATH, ),
{create_authenticator, ?GLOBAL, IncorrectConfig}),
{error, not_authorized} = emqx_access_control:authenticate( {error, not_authorized} = emqx_access_control:authenticate(
#{ #{

View File

@ -51,7 +51,7 @@ description() ->
init(#{query := SQL} = Source0) -> init(#{query := SQL} = Source0) ->
{PrepareSQL, TmplToken} = emqx_authz_utils:parse_sql(SQL, '?', ?PLACEHOLDERS), {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 case emqx_authz_utils:create_resource(emqx_connector_mysql, Source) of
{error, Reason} -> {error, Reason} ->
error({load_config_error, Reason}); error({load_config_error, Reason});