test: invalid map key is caught by hocon
now that hocon has a built-in map key validation, some of the resource name validations are cought by hocon
This commit is contained in:
parent
5446bc305f
commit
947cddb2eb
|
@ -216,7 +216,7 @@ t_create_with_bad_name(_Config) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
t_create_with_bad_name_root(_Config) ->
|
t_create_with_bad_name_root(_Config) ->
|
||||||
BadBridgeName = <<"test_哈哈">>,
|
BadBridgeName = <<"test_哈哈"/utf8>>,
|
||||||
BridgeConf = #{
|
BridgeConf = #{
|
||||||
<<"bridge_mode">> => false,
|
<<"bridge_mode">> => false,
|
||||||
<<"clean_start">> => true,
|
<<"clean_start">> => true,
|
||||||
|
|
|
@ -1431,7 +1431,7 @@ t_cluster_later_join_metrics(Config) ->
|
||||||
t_create_with_bad_name(Config) ->
|
t_create_with_bad_name(Config) ->
|
||||||
Port = ?config(port, Config),
|
Port = ?config(port, Config),
|
||||||
URL1 = ?URL(Port, "path1"),
|
URL1 = ?URL(Port, "path1"),
|
||||||
Name = <<"test_哈哈">>,
|
Name = <<"test_哈哈"/utf8>>,
|
||||||
BadBridgeParams =
|
BadBridgeParams =
|
||||||
emqx_utils_maps:deep_merge(
|
emqx_utils_maps:deep_merge(
|
||||||
?HTTP_BRIDGE(URL1, Name),
|
?HTTP_BRIDGE(URL1, Name),
|
||||||
|
@ -1457,7 +1457,7 @@ t_create_with_bad_name(Config) ->
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
#{
|
#{
|
||||||
<<"kind">> := <<"validation_error">>,
|
<<"kind">> := <<"validation_error">>,
|
||||||
<<"reason">> := <<"Invalid name format.", _/binary>>
|
<<"reason">> := <<"invalid_map_key">>
|
||||||
},
|
},
|
||||||
Msg
|
Msg
|
||||||
),
|
),
|
||||||
|
|
|
@ -604,8 +604,7 @@ deprecated_config() ->
|
||||||
t_name_too_long(_Config) ->
|
t_name_too_long(_Config) ->
|
||||||
LongName = list_to_binary(lists:duplicate(256, $a)),
|
LongName = list_to_binary(lists:duplicate(256, $a)),
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
{error,
|
{error, {{_, 400, _}, _, #{<<"message">> := #{<<"reason">> := <<"invalid_map_key">>}}}},
|
||||||
{{_, 400, _}, _, #{<<"message">> := #{<<"reason">> := <<"Name is too long", _/binary>>}}}},
|
|
||||||
create_bridge_http_api_v1(#{name => LongName})
|
create_bridge_http_api_v1(#{name => LongName})
|
||||||
),
|
),
|
||||||
ok.
|
ok.
|
||||||
|
@ -942,7 +941,7 @@ t_scenario_2(Config) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
t_create_with_bad_name(_Config) ->
|
t_create_with_bad_name(_Config) ->
|
||||||
BadBridgeName = <<"test_哈哈">>,
|
BadBridgeName = <<"test_哈哈"/utf8>>,
|
||||||
%% Note: must contain SSL options to trigger bug.
|
%% Note: must contain SSL options to trigger bug.
|
||||||
Cacertfile = emqx_common_test_helpers:app_path(
|
Cacertfile = emqx_common_test_helpers:app_path(
|
||||||
emqx,
|
emqx,
|
||||||
|
@ -960,7 +959,7 @@ t_create_with_bad_name(_Config) ->
|
||||||
<<"code">> := <<"BAD_REQUEST">>,
|
<<"code">> := <<"BAD_REQUEST">>,
|
||||||
<<"message">> := #{
|
<<"message">> := #{
|
||||||
<<"kind">> := <<"validation_error">>,
|
<<"kind">> := <<"validation_error">>,
|
||||||
<<"reason">> := <<"Invalid name format.", _/binary>>
|
<<"reason">> := <<"invalid_map_key">>
|
||||||
}
|
}
|
||||||
}}} = create_bridge_http_api_v1(Opts),
|
}}} = create_bridge_http_api_v1(Opts),
|
||||||
ok.
|
ok.
|
||||||
|
|
|
@ -275,7 +275,7 @@ t_create_with_bad_name_root_path({'end', _Config}) ->
|
||||||
ok;
|
ok;
|
||||||
t_create_with_bad_name_root_path(_Config) ->
|
t_create_with_bad_name_root_path(_Config) ->
|
||||||
Path = [connectors],
|
Path = [connectors],
|
||||||
BadConnectorName = <<"test_哈哈">>,
|
BadConnectorName = <<"test_哈哈"/utf8>>,
|
||||||
ConnConfig0 = connector_config(),
|
ConnConfig0 = connector_config(),
|
||||||
%% Note: must contain SSL options to trigger original bug.
|
%% Note: must contain SSL options to trigger original bug.
|
||||||
Cacertfile = emqx_common_test_helpers:app_path(
|
Cacertfile = emqx_common_test_helpers:app_path(
|
||||||
|
|
|
@ -697,7 +697,7 @@ t_connectors_probe(Config) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
t_create_with_bad_name(Config) ->
|
t_create_with_bad_name(Config) ->
|
||||||
ConnectorName = <<"test_哈哈">>,
|
ConnectorName = <<"test_哈哈"/utf8>>,
|
||||||
Conf0 = ?KAFKA_CONNECTOR(ConnectorName),
|
Conf0 = ?KAFKA_CONNECTOR(ConnectorName),
|
||||||
%% Note: must contain SSL options to trigger original bug.
|
%% Note: must contain SSL options to trigger original bug.
|
||||||
Cacertfile = emqx_common_test_helpers:app_path(
|
Cacertfile = emqx_common_test_helpers:app_path(
|
||||||
|
|
Loading…
Reference in New Issue