Merge pull request #7931 from HJianBo/gw-fixes

Increase the wait time to get the error of creating authn
This commit is contained in:
JianBo He 2022-05-13 10:10:34 +08:00 committed by GitHub
commit bcac65310b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 13 deletions

View File

@ -87,7 +87,9 @@ update(Pid, Config) ->
call(Pid, {update, Config}). call(Pid, {update, Config}).
call(Pid, Req) -> call(Pid, Req) ->
gen_server:call(Pid, Req, 5000). %% The large timeout aim to get the modified results of the dependent
%% resources
gen_server:call(Pid, Req, 15000).
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% gen_server callbacks %% gen_server callbacks

View File

@ -167,16 +167,17 @@ start_grpc_server(GwName, Options = #{bind := ListenOn}) ->
)} )}
] ]
end, end,
ListenOnStr = emqx_listeners:format_addr(ListenOn),
case grpc:start_server(GwName, ListenOn, Services, SvrOptions) of case grpc:start_server(GwName, ListenOn, Services, SvrOptions) of
{ok, _SvrPid} -> {ok, _SvrPid} ->
console_print( console_print(
"Start ~ts gRPC server on ~p successfully.~n", "Start ~ts gRPC server on ~s successfully.~n",
[GwName, ListenOn] [GwName, ListenOnStr]
); );
{error, Reason} -> {error, Reason} ->
?ELOG( ?ELOG(
"Failed to start ~ts gRPC server on ~p, reason: ~0p", "Failed to start ~ts gRPC server on ~s, reason: ~0p",
[GwName, ListenOn, Reason] [GwName, ListenOnStr, Reason]
), ),
throw( throw(
{badconf, #{ {badconf, #{

View File

@ -211,9 +211,7 @@ t_gateway_exproto_with_ssl(_) ->
name => <<"exproto">>, name => <<"exproto">>,
server => #{ server => #{
bind => <<"9100">>, bind => <<"9100">>,
ssl => SslSvrOpts#{ ssl => SslSvrOpts
enable => true
}
}, },
handler => #{ handler => #{
address => <<"http://127.0.0.1:9001">>, address => <<"http://127.0.0.1:9001">>,
@ -230,7 +228,7 @@ t_gateway_exproto_with_ssl(_) ->
GwConf2 = emqx_map_lib:deep_merge(GwConf, #{ GwConf2 = emqx_map_lib:deep_merge(GwConf, #{
server => #{ server => #{
bind => <<"9200">>, bind => <<"9200">>,
ssl => SslCliOpts#{enable => true} ssl => SslCliOpts
} }
}), }),
{200, _} = request(put, "/gateway/exproto", maps:without([name, listeners], GwConf2)), {200, _} = request(put, "/gateway/exproto", maps:without([name, listeners], GwConf2)),

View File

@ -862,10 +862,12 @@ format_channel_info({_, ClientInfo0, ClientStats}) ->
], ],
TimesKeys = [created_at, connected_at, disconnected_at], TimesKeys = [created_at, connected_at, disconnected_at],
%% format timestamp to rfc3339 %% format timestamp to rfc3339
lists:foldl( result_format_undefined_to_null(
fun result_format_time_fun/2, lists:foldl(
maps:without(RemoveList, ClientInfoMap), fun result_format_time_fun/2,
TimesKeys maps:without(RemoveList, ClientInfoMap),
TimesKeys
)
). ).
%% format func helpers %% format func helpers
@ -884,6 +886,15 @@ result_format_time_fun(Key, NClientInfoMap) ->
NClientInfoMap NClientInfoMap
end. end.
result_format_undefined_to_null(Map) ->
maps:map(
fun
(_, undefined) -> null;
(_, V) -> V
end,
Map
).
-spec peername_dispart(emqx_types:peername()) -> {binary(), inet:port_number()}. -spec peername_dispart(emqx_types:peername()) -> {binary(), inet:port_number()}.
peername_dispart({Addr, Port}) -> peername_dispart({Addr, Port}) ->
AddrBinary = list_to_binary(inet:ntoa(Addr)), AddrBinary = list_to_binary(inet:ntoa(Addr)),