refactor: delete emqx_resource:recreate

this api is only used in tests, changed to call the _local flavor
instead
This commit is contained in:
Zaiming (Stone) Shi 2024-02-20 19:44:16 +01:00
parent 1878fded5a
commit 8541d2efc1
2 changed files with 2 additions and 30 deletions

View File

@ -30,7 +30,6 @@
check_config/2,
check_and_create_local/4,
check_and_create_local/5,
check_and_recreate/4,
check_and_recreate_local/4
]).
@ -45,9 +44,6 @@
create_dry_run_local/2,
create_dry_run_local/3,
create_dry_run_local/4,
%% this will do create_dry_run, stop the old instance and start a new one
recreate/3,
recreate/4,
recreate_local/3,
recreate_local/4,
%% remove the config and stop the instance
@ -301,16 +297,6 @@ when
create_dry_run_local(ResId, ResourceType, Config, OnReadyCallback) ->
emqx_resource_manager:create_dry_run(ResId, ResourceType, Config, OnReadyCallback).
-spec recreate(resource_id(), resource_type(), resource_config()) ->
{ok, resource_data()} | {error, Reason :: term()}.
recreate(ResId, ResourceType, Config) ->
recreate(ResId, ResourceType, Config, #{}).
-spec recreate(resource_id(), resource_type(), resource_config(), creation_opts()) ->
{ok, resource_data()} | {error, Reason :: term()}.
recreate(ResId, ResourceType, Config, Opts) ->
emqx_resource_proto_v1:recreate(ResId, ResourceType, Config, Opts).
-spec recreate_local(resource_id(), resource_type(), resource_config()) ->
{ok, resource_data()} | {error, Reason :: term()}.
recreate_local(ResId, ResourceType, Config) ->
@ -619,20 +605,6 @@ check_and_create_local(ResId, Group, ResourceType, RawConfig, Opts) ->
fun(ResConf) -> create_local(ResId, Group, ResourceType, ResConf, Opts) end
).
-spec check_and_recreate(
resource_id(),
resource_type(),
raw_resource_config(),
creation_opts()
) ->
{ok, resource_data()} | {error, term()}.
check_and_recreate(ResId, ResourceType, RawConfig, Opts) ->
check_and_do(
ResourceType,
RawConfig,
fun(ResConf) -> recreate(ResId, ResourceType, ResConf, Opts) end
).
-spec check_and_recreate_local(
resource_id(),
resource_type(),

View File

@ -98,7 +98,7 @@ t_create_remove(_) ->
?assertMatch(
{ok, _},
emqx_resource:recreate(
emqx_resource:recreate_local(
?ID,
?TEST_RESOURCE,
#{name => test_resource},
@ -964,7 +964,7 @@ t_stop_start(_) ->
?assertMatch(
{ok, _},
emqx_resource:check_and_recreate(
emqx_resource:check_and_recreate_local(
?ID,
?TEST_RESOURCE,
#{<<"name">> => <<"test_resource">>},