fix(bridge_v1): return 400 if trying to delete shared bridge via http api v1
This commit is contained in:
parent
ae760a4ca1
commit
c03979a48a
|
@ -530,7 +530,7 @@ schema("/bridges_probe") ->
|
||||||
{error, not_found} ->
|
{error, not_found} ->
|
||||||
?BRIDGE_NOT_FOUND(BridgeType, BridgeName);
|
?BRIDGE_NOT_FOUND(BridgeType, BridgeName);
|
||||||
{error, not_bridge_v1_compatible} ->
|
{error, not_bridge_v1_compatible} ->
|
||||||
?BAD_REQUEST('ALREADY_EXISTS', non_compat_bridge_msg())
|
?BAD_REQUEST(non_compat_bridge_msg())
|
||||||
end
|
end
|
||||||
).
|
).
|
||||||
|
|
||||||
|
|
|
@ -616,6 +616,28 @@ t_scenario_1(_Config) ->
|
||||||
%% ?assertMatch({ok, {{_, 204, _}, _, _}}, bridge_node_operation_http_api_v2(NameA, restart)),
|
%% ?assertMatch({ok, {{_, 204, _}, _, _}}, bridge_node_operation_http_api_v2(NameA, restart)),
|
||||||
%% ?assertMatch({ok, {{_, 204, _}, _, _}}, bridge_node_operation_http_api_v2(NameB, restart)),
|
%% ?assertMatch({ok, {{_, 204, _}, _, _}}, bridge_node_operation_http_api_v2(NameB, restart)),
|
||||||
|
|
||||||
|
%% ===================================================================================
|
||||||
|
%% Try to delete the original bridge using V1. It should fail and its connector
|
||||||
|
%% should be preserved.
|
||||||
|
%% ===================================================================================
|
||||||
|
?assertMatch(
|
||||||
|
{error, {{_, 400, _}, _, _}},
|
||||||
|
delete_bridge_http_api_v1(#{name => NameA})
|
||||||
|
),
|
||||||
|
?assertMatch({ok, {{_, 200, _}, _, []}}, list_bridges_http_api_v1()),
|
||||||
|
?assertMatch(
|
||||||
|
{ok, {{_, 200, _}, _, [#{<<"name">> := _}, #{<<"name">> := _}]}}, list_bridges_http_api_v2()
|
||||||
|
),
|
||||||
|
?assertMatch({ok, {{_, 200, _}, _, [#{}, #{}]}}, list_connectors_http()),
|
||||||
|
?assertMatch({error, {{_, 404, _}, _, #{}}}, get_bridge_http_api_v1(NameA)),
|
||||||
|
?assertMatch({error, {{_, 404, _}, _, #{}}}, get_bridge_http_api_v1(NameB)),
|
||||||
|
?assertMatch({ok, {{_, 200, _}, _, #{<<"name">> := NameA}}}, get_bridge_http_api_v2(NameA)),
|
||||||
|
?assertMatch({ok, {{_, 200, _}, _, #{<<"name">> := NameB}}}, get_bridge_http_api_v2(NameB)),
|
||||||
|
?assertMatch(
|
||||||
|
{ok, {{_, 200, _}, _, #{<<"name">> := GeneratedConnName}}},
|
||||||
|
get_connector_http(GeneratedConnName)
|
||||||
|
),
|
||||||
|
|
||||||
%% ===================================================================================
|
%% ===================================================================================
|
||||||
%% Delete the 2nd new bridge so it appears again in the V1 API.
|
%% Delete the 2nd new bridge so it appears again in the V1 API.
|
||||||
%% ===================================================================================
|
%% ===================================================================================
|
||||||
|
|
Loading…
Reference in New Issue