chore: fix failed test cases
This commit is contained in:
parent
cdb90ebe6b
commit
c8b5c51bbc
|
@ -50,7 +50,7 @@
|
||||||
-define(APPS_CLUSTERING, [gen_rpc, mria, ekka]).
|
-define(APPS_CLUSTERING, [gen_rpc, mria, ekka]).
|
||||||
|
|
||||||
-define(TIMEOUT_NODE_START_MS, 15000).
|
-define(TIMEOUT_NODE_START_MS, 15000).
|
||||||
-define(TIMEOUT_APPS_START_MS, 30000).
|
-define(TIMEOUT_APPS_START_MS, 60000).
|
||||||
-define(TIMEOUT_NODE_STOP_S, 15).
|
-define(TIMEOUT_NODE_STOP_S, 15).
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
|
@ -453,8 +453,6 @@ stop_apps(Apps) ->
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
verify_clean_suite_state(#{allow_dirty_work_dir := true}) ->
|
|
||||||
ok;
|
|
||||||
verify_clean_suite_state(#{work_dir := WorkDir}) ->
|
verify_clean_suite_state(#{work_dir := WorkDir}) ->
|
||||||
{ok, []} = file:list_dir(WorkDir),
|
{ok, []} = file:list_dir(WorkDir),
|
||||||
false = emqx_schema_hooks:any_injections(),
|
false = emqx_schema_hooks:any_injections(),
|
||||||
|
|
|
@ -77,7 +77,7 @@ hard_coded_action_info_modules_ee() ->
|
||||||
-endif.
|
-endif.
|
||||||
|
|
||||||
hard_coded_action_info_modules_common() ->
|
hard_coded_action_info_modules_common() ->
|
||||||
[].
|
[emqx_bridge_http_action_info].
|
||||||
|
|
||||||
hard_coded_action_info_modules() ->
|
hard_coded_action_info_modules() ->
|
||||||
hard_coded_action_info_modules_common() ++ hard_coded_action_info_modules_ee().
|
hard_coded_action_info_modules_common() ++ hard_coded_action_info_modules_ee().
|
||||||
|
|
|
@ -357,7 +357,7 @@ get_metrics(Type, Name) ->
|
||||||
maybe_upgrade(mqtt, Config) ->
|
maybe_upgrade(mqtt, Config) ->
|
||||||
emqx_bridge_compatible_config:maybe_upgrade(Config);
|
emqx_bridge_compatible_config:maybe_upgrade(Config);
|
||||||
maybe_upgrade(webhook, Config) ->
|
maybe_upgrade(webhook, Config) ->
|
||||||
emqx_bridge_compatible_config:webhook_maybe_upgrade(Config);
|
emqx_bridge_compatible_config:http_maybe_upgrade(Config);
|
||||||
maybe_upgrade(_Other, Config) ->
|
maybe_upgrade(_Other, Config) ->
|
||||||
Config.
|
Config.
|
||||||
|
|
||||||
|
|
|
@ -74,8 +74,8 @@ bridge_to_resource_type(BridgeType) ->
|
||||||
|
|
||||||
bridge_impl_module(BridgeType) -> emqx_bridge_enterprise:bridge_impl_module(BridgeType).
|
bridge_impl_module(BridgeType) -> emqx_bridge_enterprise:bridge_impl_module(BridgeType).
|
||||||
-else.
|
-else.
|
||||||
bridge_to_resource_type(BridgeType) when is_binary(Type) ->
|
bridge_to_resource_type(BridgeType) when is_binary(BridgeType) ->
|
||||||
bridge_to_resource_type(binary_to_existing_atom(Type, utf8));
|
bridge_to_resource_type(binary_to_existing_atom(BridgeType, utf8));
|
||||||
bridge_to_resource_type(mqtt) ->
|
bridge_to_resource_type(mqtt) ->
|
||||||
emqx_bridge_mqtt_connector;
|
emqx_bridge_mqtt_connector;
|
||||||
bridge_to_resource_type(webhook) ->
|
bridge_to_resource_type(webhook) ->
|
||||||
|
|
|
@ -21,7 +21,7 @@ empty_config_test() ->
|
||||||
Conf1 = #{<<"bridges">> => #{}},
|
Conf1 = #{<<"bridges">> => #{}},
|
||||||
Conf2 = #{<<"bridges">> => #{<<"webhook">> => #{}}},
|
Conf2 = #{<<"bridges">> => #{<<"webhook">> => #{}}},
|
||||||
?assertEqual(Conf1, check(Conf1)),
|
?assertEqual(Conf1, check(Conf1)),
|
||||||
?assertEqual(Conf2, check(Conf2)),
|
?assertEqual(#{<<"bridges">> => #{<<"http">> => #{}}}, check(Conf2)),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
%% ensure webhook config can be checked
|
%% ensure webhook config can be checked
|
||||||
|
@ -33,7 +33,7 @@ webhook_config_test() ->
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
#{
|
#{
|
||||||
<<"bridges">> := #{
|
<<"bridges">> := #{
|
||||||
<<"webhook">> := #{
|
<<"http">> := #{
|
||||||
<<"the_name">> :=
|
<<"the_name">> :=
|
||||||
#{
|
#{
|
||||||
<<"method">> := get,
|
<<"method">> := get,
|
||||||
|
@ -48,7 +48,7 @@ webhook_config_test() ->
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
#{
|
#{
|
||||||
<<"bridges">> := #{
|
<<"bridges">> := #{
|
||||||
<<"webhook">> := #{
|
<<"http">> := #{
|
||||||
<<"the_name">> :=
|
<<"the_name">> :=
|
||||||
#{
|
#{
|
||||||
<<"method">> := get,
|
<<"method">> := get,
|
||||||
|
@ -61,7 +61,7 @@ webhook_config_test() ->
|
||||||
),
|
),
|
||||||
#{
|
#{
|
||||||
<<"bridges">> := #{
|
<<"bridges">> := #{
|
||||||
<<"webhook">> := #{
|
<<"http">> := #{
|
||||||
<<"the_name">> :=
|
<<"the_name">> :=
|
||||||
#{
|
#{
|
||||||
<<"method">> := get,
|
<<"method">> := get,
|
||||||
|
|
|
@ -54,19 +54,18 @@ fields("config") ->
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% v2: configuration
|
%% v2: configuration
|
||||||
fields(action) ->
|
fields(action) ->
|
||||||
%% XXX: Do we need to rename it to `http`?
|
|
||||||
{http,
|
{http,
|
||||||
mk(
|
mk(
|
||||||
hoconsc:map(name, ref(?MODULE, http_action)),
|
hoconsc:map(name, ref(?MODULE, "http_action")),
|
||||||
#{
|
#{
|
||||||
aliases => [webhook],
|
aliases => [webhook],
|
||||||
desc => <<"HTTP Action Config">>,
|
desc => <<"HTTP Action Config">>,
|
||||||
required => false
|
required => false
|
||||||
}
|
}
|
||||||
)};
|
)};
|
||||||
fields(http_action) ->
|
fields("http_action") ->
|
||||||
[
|
[
|
||||||
{enable, mk(boolean(), #{desc => ?DESC("config_enable"), default => true})},
|
{enable, mk(boolean(), #{desc => ?DESC("config_enable_bridge"), default => true})},
|
||||||
{connector,
|
{connector,
|
||||||
mk(binary(), #{
|
mk(binary(), #{
|
||||||
desc => ?DESC(emqx_connector_schema, "connector_field"), required => true
|
desc => ?DESC(emqx_connector_schema, "connector_field"), required => true
|
||||||
|
@ -88,12 +87,12 @@ fields(http_action) ->
|
||||||
%% some fields are moved to connector, some fields are moved to actions and composed into the
|
%% some fields are moved to connector, some fields are moved to actions and composed into the
|
||||||
%% `parameters` field.
|
%% `parameters` field.
|
||||||
{parameters,
|
{parameters,
|
||||||
mk(ref(parameters_opts), #{
|
mk(ref("parameters_opts"), #{
|
||||||
required => true,
|
required => true,
|
||||||
desc => ?DESC(parameters_opts)
|
desc => ?DESC("config_parameters_opts")
|
||||||
})}
|
})}
|
||||||
] ++ http_resource_opts();
|
] ++ http_resource_opts();
|
||||||
fields(parameters_opts) ->
|
fields("parameters_opts") ->
|
||||||
[
|
[
|
||||||
{path,
|
{path,
|
||||||
mk(
|
mk(
|
||||||
|
@ -120,7 +119,7 @@ fields("put_" ++ Type) ->
|
||||||
fields("get_" ++ Type) ->
|
fields("get_" ++ Type) ->
|
||||||
emqx_bridge_schema:status_fields() ++ fields("post_" ++ Type);
|
emqx_bridge_schema:status_fields() ++ fields("post_" ++ Type);
|
||||||
fields("config_bridge_v2") ->
|
fields("config_bridge_v2") ->
|
||||||
fields(http_action);
|
fields("http_action");
|
||||||
fields("config_connector") ->
|
fields("config_connector") ->
|
||||||
[
|
[
|
||||||
{enable,
|
{enable,
|
||||||
|
@ -150,6 +149,10 @@ desc(Method) when Method =:= "get"; Method =:= "put"; Method =:= "post" ->
|
||||||
["Configuration for WebHook using `", string:to_upper(Method), "` method."];
|
["Configuration for WebHook using `", string:to_upper(Method), "` method."];
|
||||||
desc("config_connector") ->
|
desc("config_connector") ->
|
||||||
?DESC("desc_config");
|
?DESC("desc_config");
|
||||||
|
desc("http_action") ->
|
||||||
|
?DESC("desc_config");
|
||||||
|
desc("parameters_opts") ->
|
||||||
|
?DESC("config_parameters_opts");
|
||||||
desc(_) ->
|
desc(_) ->
|
||||||
undefined.
|
undefined.
|
||||||
|
|
||||||
|
|
|
@ -452,6 +452,7 @@ apps_to_start() ->
|
||||||
emqx_modules,
|
emqx_modules,
|
||||||
emqx_gateway,
|
emqx_gateway,
|
||||||
emqx_exhook,
|
emqx_exhook,
|
||||||
|
emqx_bridge_http,
|
||||||
emqx_bridge,
|
emqx_bridge,
|
||||||
emqx_auto_subscribe,
|
emqx_auto_subscribe,
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ worker_pool_size_test_() ->
|
||||||
Conf = emqx_utils_maps:deep_put(
|
Conf = emqx_utils_maps:deep_put(
|
||||||
[
|
[
|
||||||
<<"bridges">>,
|
<<"bridges">>,
|
||||||
<<"webhook">>,
|
<<"http">>,
|
||||||
<<"simple">>,
|
<<"simple">>,
|
||||||
<<"resource_opts">>,
|
<<"resource_opts">>,
|
||||||
<<"worker_pool_size">>
|
<<"worker_pool_size">>
|
||||||
|
@ -88,7 +88,7 @@ worker_pool_size_test_() ->
|
||||||
BaseConf,
|
BaseConf,
|
||||||
WorkerPoolSize
|
WorkerPoolSize
|
||||||
),
|
),
|
||||||
#{<<"bridges">> := #{<<"webhook">> := #{<<"simple">> := CheckedConf}}} = check(Conf),
|
#{<<"bridges">> := #{<<"http">> := #{<<"simple">> := CheckedConf}}} = check(Conf),
|
||||||
#{<<"resource_opts">> := #{<<"worker_pool_size">> := WPS}} = CheckedConf,
|
#{<<"resource_opts">> := #{<<"worker_pool_size">> := WPS}} = CheckedConf,
|
||||||
WPS
|
WPS
|
||||||
end,
|
end,
|
||||||
|
@ -117,7 +117,7 @@ worker_pool_size_test_() ->
|
||||||
%%===========================================================================
|
%%===========================================================================
|
||||||
|
|
||||||
parse_and_check_webhook_bridge(Hocon) ->
|
parse_and_check_webhook_bridge(Hocon) ->
|
||||||
#{<<"bridges">> := #{<<"webhook">> := #{<<"simple">> := Conf}}} = check(parse(Hocon)),
|
#{<<"bridges">> := #{<<"http">> := #{<<"simple">> := Conf}}} = check(parse(Hocon)),
|
||||||
Conf.
|
Conf.
|
||||||
|
|
||||||
parse(Hocon) ->
|
parse(Hocon) ->
|
||||||
|
|
|
@ -3468,7 +3468,7 @@ t_get_basic_usage_info_1(_Config) ->
|
||||||
referenced_bridges =>
|
referenced_bridges =>
|
||||||
#{
|
#{
|
||||||
mqtt => 1,
|
mqtt => 1,
|
||||||
webhook => 3
|
http => 3
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
emqx_rule_engine:get_basic_usage_info()
|
emqx_rule_engine:get_basic_usage_info()
|
||||||
|
|
|
@ -544,7 +544,7 @@ t_rule_engine_and_data_bridge_info(_Config) ->
|
||||||
#{
|
#{
|
||||||
data_bridge =>
|
data_bridge =>
|
||||||
#{
|
#{
|
||||||
webhook => #{num => 1, num_linked_by_rules => 3},
|
http => #{num => 1, num_linked_by_rules => 3},
|
||||||
mqtt => #{num => 2, num_linked_by_rules => 2}
|
mqtt => #{num => 2, num_linked_by_rules => 2}
|
||||||
},
|
},
|
||||||
num_data_bridges => 3
|
num_data_bridges => 3
|
||||||
|
|
|
@ -80,6 +80,12 @@ Template with variables is allowed in this option. For example, <code>/room/{$ro
|
||||||
config_path.label:
|
config_path.label:
|
||||||
"""URL Path"""
|
"""URL Path"""
|
||||||
|
|
||||||
|
config_parameters_opts.desc:
|
||||||
|
"""The parameters for HTTP action."""
|
||||||
|
|
||||||
|
config_parameters_opts.label:
|
||||||
|
"""Parameters"""
|
||||||
|
|
||||||
desc_config.desc:
|
desc_config.desc:
|
||||||
"""Configuration for an HTTP bridge."""
|
"""Configuration for an HTTP bridge."""
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue