fix: api_listener min TLS ct fail
This commit is contained in:
parent
4f9b42a250
commit
2c95fba4df
|
@ -72,19 +72,19 @@ t_wss_crud_listeners_by_id(_) ->
|
||||||
crud_listeners_by_id(ListenerId, NewListenerId, MinListenerId, BadId, Type).
|
crud_listeners_by_id(ListenerId, NewListenerId, MinListenerId, BadId, Type).
|
||||||
|
|
||||||
crud_listeners_by_id(ListenerId, NewListenerId, MinListenerId, BadId, Type) ->
|
crud_listeners_by_id(ListenerId, NewListenerId, MinListenerId, BadId, Type) ->
|
||||||
TcpPath = emqx_mgmt_api_test_util:api_path(["listeners", ListenerId]),
|
OriginPath = emqx_mgmt_api_test_util:api_path(["listeners", ListenerId]),
|
||||||
NewPath = emqx_mgmt_api_test_util:api_path(["listeners", NewListenerId]),
|
NewPath = emqx_mgmt_api_test_util:api_path(["listeners", NewListenerId]),
|
||||||
TcpListener = request(get, TcpPath, [], []),
|
OriginListener = request(get, OriginPath, [], []),
|
||||||
|
|
||||||
%% create with full options
|
%% create with full options
|
||||||
?assertEqual({error, not_found}, is_running(NewListenerId)),
|
?assertEqual({error, not_found}, is_running(NewListenerId)),
|
||||||
?assertMatch({error, {"HTTP/1.1", 404, _}}, request(get, NewPath, [], [])),
|
?assertMatch({error, {"HTTP/1.1", 404, _}}, request(get, NewPath, [], [])),
|
||||||
NewConf = TcpListener#{
|
NewConf = OriginListener#{
|
||||||
<<"id">> => NewListenerId,
|
<<"id">> => NewListenerId,
|
||||||
<<"bind">> => <<"0.0.0.0:2883">>
|
<<"bind">> => <<"0.0.0.0:2883">>
|
||||||
},
|
},
|
||||||
Create = request(post, NewPath, [], NewConf),
|
Create = request(post, NewPath, [], NewConf),
|
||||||
?assertEqual(lists:sort(maps:keys(TcpListener)), lists:sort(maps:keys(Create))),
|
?assertEqual(lists:sort(maps:keys(OriginListener)), lists:sort(maps:keys(Create))),
|
||||||
Get1 = request(get, NewPath, [], []),
|
Get1 = request(get, NewPath, [], []),
|
||||||
?assertMatch(Create, Get1),
|
?assertMatch(Create, Get1),
|
||||||
?assert(is_running(NewListenerId)),
|
?assert(is_running(NewListenerId)),
|
||||||
|
@ -93,20 +93,42 @@ crud_listeners_by_id(ListenerId, NewListenerId, MinListenerId, BadId, Type) ->
|
||||||
MinPath = emqx_mgmt_api_test_util:api_path(["listeners", MinListenerId]),
|
MinPath = emqx_mgmt_api_test_util:api_path(["listeners", MinListenerId]),
|
||||||
?assertEqual({error, not_found}, is_running(MinListenerId)),
|
?assertEqual({error, not_found}, is_running(MinListenerId)),
|
||||||
?assertMatch({error, {"HTTP/1.1", 404, _}}, request(get, MinPath, [], [])),
|
?assertMatch({error, {"HTTP/1.1", 404, _}}, request(get, MinPath, [], [])),
|
||||||
MinConf = #{
|
MinConf =
|
||||||
<<"id">> => MinListenerId,
|
case OriginListener of
|
||||||
<<"bind">> => <<"0.0.0.0:3883">>,
|
#{
|
||||||
<<"type">> => Type
|
<<"ssl">> :=
|
||||||
},
|
#{
|
||||||
|
<<"cacertfile">> := CaCertFile,
|
||||||
|
<<"certfile">> := CertFile,
|
||||||
|
<<"keyfile">> := KeyFile
|
||||||
|
}
|
||||||
|
} ->
|
||||||
|
#{
|
||||||
|
<<"id">> => MinListenerId,
|
||||||
|
<<"bind">> => <<"0.0.0.0:3883">>,
|
||||||
|
<<"type">> => Type,
|
||||||
|
<<"ssl">> => #{
|
||||||
|
<<"cacertfile">> => CaCertFile,
|
||||||
|
<<"certfile">> => CertFile,
|
||||||
|
<<"keyfile">> => KeyFile
|
||||||
|
}
|
||||||
|
};
|
||||||
|
_ ->
|
||||||
|
#{
|
||||||
|
<<"id">> => MinListenerId,
|
||||||
|
<<"bind">> => <<"0.0.0.0:3883">>,
|
||||||
|
<<"type">> => Type
|
||||||
|
}
|
||||||
|
end,
|
||||||
MinCreate = request(post, MinPath, [], MinConf),
|
MinCreate = request(post, MinPath, [], MinConf),
|
||||||
?assertEqual(lists:sort(maps:keys(TcpListener)), lists:sort(maps:keys(MinCreate))),
|
?assertEqual(lists:sort(maps:keys(OriginListener)), lists:sort(maps:keys(MinCreate))),
|
||||||
MinGet = request(get, MinPath, [], []),
|
MinGet = request(get, MinPath, [], []),
|
||||||
?assertMatch(MinCreate, MinGet),
|
?assertMatch(MinCreate, MinGet),
|
||||||
?assert(is_running(MinListenerId)),
|
?assert(is_running(MinListenerId)),
|
||||||
|
|
||||||
%% bad create(same port)
|
%% bad create(same port)
|
||||||
BadPath = emqx_mgmt_api_test_util:api_path(["listeners", BadId]),
|
BadPath = emqx_mgmt_api_test_util:api_path(["listeners", BadId]),
|
||||||
BadConf = TcpListener#{
|
BadConf = OriginListener#{
|
||||||
<<"id">> => BadId,
|
<<"id">> => BadId,
|
||||||
<<"bind">> => <<"0.0.0.0:2883">>
|
<<"bind">> => <<"0.0.0.0:2883">>
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue