test(gw): fix bad test cases
This commit is contained in:
parent
e662628581
commit
fa11c6df9c
|
@ -69,7 +69,7 @@ gateway(["load", Name, Conf]) ->
|
|||
bin(Name),
|
||||
emqx_json:decode(Conf, [return_maps])
|
||||
) of
|
||||
ok ->
|
||||
{ok, _} ->
|
||||
print("ok~n");
|
||||
{error, Reason} ->
|
||||
print("Error: ~p~n", [Reason])
|
||||
|
@ -88,7 +88,7 @@ gateway(["stop", Name]) ->
|
|||
bin(Name),
|
||||
#{<<"enable">> => <<"false">>}
|
||||
) of
|
||||
ok ->
|
||||
{ok, _} ->
|
||||
print("ok~n");
|
||||
{error, Reason} ->
|
||||
print("Error: ~p~n", [Reason])
|
||||
|
@ -99,7 +99,7 @@ gateway(["start", Name]) ->
|
|||
bin(Name),
|
||||
#{<<"enable">> => <<"true">>}
|
||||
) of
|
||||
ok ->
|
||||
{ok, _} ->
|
||||
print("ok~n");
|
||||
{error, Reason} ->
|
||||
print("Error: ~p~n", [Reason])
|
||||
|
|
|
@ -269,9 +269,9 @@ ret_gw(GwName, {ok, #{raw_config := GwConf}}) ->
|
|||
NLConfs =
|
||||
lists:map(fun({LName, LConf}) ->
|
||||
do_convert_listener2(GwName, LType, LName, LConf)
|
||||
end, proplists:from_map(SubConf)),
|
||||
end, maps:to_list(SubConf)),
|
||||
[NLConfs|Acc]
|
||||
end, [], proplists:from_map(LsConf)),
|
||||
end, [], maps:to_list(LsConf)),
|
||||
{ok, maps:merge(GwConf1, #{<<"listeners">> => NLsConf})};
|
||||
ret_gw(_GwName, Err) -> Err.
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ t_gateway_stomp(_) ->
|
|||
assert_confs(GwConf, ConfResp),
|
||||
%% put
|
||||
GwConf2 = emqx_map_lib:deep_merge(GwConf, #{frame => #{max_headers => 10}}),
|
||||
{200, _} = request(put, "/gateway/stomp", maps:without([name], GwConf2)),
|
||||
{200, _} = request(put, "/gateway/stomp", maps:without([name, listeners], GwConf2)),
|
||||
{200, ConfResp2} = request(get, "/gateway/stomp"),
|
||||
assert_confs(GwConf2, ConfResp2),
|
||||
{204, _} = request(delete, "/gateway/stomp").
|
||||
|
@ -109,7 +109,7 @@ t_gateway_mqttsn(_) ->
|
|||
assert_confs(GwConf, ConfResp),
|
||||
%% put
|
||||
GwConf2 = emqx_map_lib:deep_merge(GwConf, #{predefined => []}),
|
||||
{200, _} = request(put, "/gateway/mqttsn", maps:without([name], GwConf2)),
|
||||
{200, _} = request(put, "/gateway/mqttsn", maps:without([name, listeners], GwConf2)),
|
||||
{200, ConfResp2} = request(get, "/gateway/mqttsn"),
|
||||
assert_confs(GwConf2, ConfResp2),
|
||||
{204, _} = request(delete, "/gateway/mqttsn").
|
||||
|
@ -130,7 +130,7 @@ t_gateway_coap(_) ->
|
|||
assert_confs(GwConf, ConfResp),
|
||||
%% put
|
||||
GwConf2 = emqx_map_lib:deep_merge(GwConf, #{heartbeat => <<"10s">>}),
|
||||
{200, _} = request(put, "/gateway/coap", maps:without([name], GwConf2)),
|
||||
{200, _} = request(put, "/gateway/coap", maps:without([name, listeners], GwConf2)),
|
||||
{200, ConfResp2} = request(get, "/gateway/coap"),
|
||||
assert_confs(GwConf2, ConfResp2),
|
||||
{204, _} = request(delete, "/gateway/coap").
|
||||
|
@ -161,7 +161,7 @@ t_gateway_lwm2m(_) ->
|
|||
assert_confs(GwConf, ConfResp),
|
||||
%% put
|
||||
GwConf2 = emqx_map_lib:deep_merge(GwConf, #{qmode_time_window => <<"10s">>}),
|
||||
{200, _} = request(put, "/gateway/lwm2m", maps:without([name], GwConf2)),
|
||||
{200, _} = request(put, "/gateway/lwm2m", maps:without([name, listeners], GwConf2)),
|
||||
{200, ConfResp2} = request(get, "/gateway/lwm2m"),
|
||||
assert_confs(GwConf2, ConfResp2),
|
||||
{204, _} = request(delete, "/gateway/lwm2m").
|
||||
|
@ -182,7 +182,7 @@ t_gateway_exproto(_) ->
|
|||
assert_confs(GwConf, ConfResp),
|
||||
%% put
|
||||
GwConf2 = emqx_map_lib:deep_merge(GwConf, #{server => #{bind => <<"9200">>}}),
|
||||
{200, _} = request(put, "/gateway/exproto", maps:without([name], GwConf2)),
|
||||
{200, _} = request(put, "/gateway/exproto", maps:without([name, listeners], GwConf2)),
|
||||
{200, ConfResp2} = request(get, "/gateway/exproto"),
|
||||
assert_confs(GwConf2, ConfResp2),
|
||||
{204, _} = request(delete, "/gateway/exproto").
|
||||
|
|
Loading…
Reference in New Issue