refactor: delete emqx_resource:recreate
this api is only used in tests, changed to call the _local flavor instead
This commit is contained in:
parent
1878fded5a
commit
8541d2efc1
|
@ -30,7 +30,6 @@
|
||||||
check_config/2,
|
check_config/2,
|
||||||
check_and_create_local/4,
|
check_and_create_local/4,
|
||||||
check_and_create_local/5,
|
check_and_create_local/5,
|
||||||
check_and_recreate/4,
|
|
||||||
check_and_recreate_local/4
|
check_and_recreate_local/4
|
||||||
]).
|
]).
|
||||||
|
|
||||||
|
@ -45,9 +44,6 @@
|
||||||
create_dry_run_local/2,
|
create_dry_run_local/2,
|
||||||
create_dry_run_local/3,
|
create_dry_run_local/3,
|
||||||
create_dry_run_local/4,
|
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/3,
|
||||||
recreate_local/4,
|
recreate_local/4,
|
||||||
%% remove the config and stop the instance
|
%% remove the config and stop the instance
|
||||||
|
@ -301,16 +297,6 @@ when
|
||||||
create_dry_run_local(ResId, ResourceType, Config, OnReadyCallback) ->
|
create_dry_run_local(ResId, ResourceType, Config, OnReadyCallback) ->
|
||||||
emqx_resource_manager:create_dry_run(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()) ->
|
-spec recreate_local(resource_id(), resource_type(), resource_config()) ->
|
||||||
{ok, resource_data()} | {error, Reason :: term()}.
|
{ok, resource_data()} | {error, Reason :: term()}.
|
||||||
recreate_local(ResId, ResourceType, Config) ->
|
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
|
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(
|
-spec check_and_recreate_local(
|
||||||
resource_id(),
|
resource_id(),
|
||||||
resource_type(),
|
resource_type(),
|
||||||
|
|
|
@ -98,7 +98,7 @@ t_create_remove(_) ->
|
||||||
|
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
{ok, _},
|
{ok, _},
|
||||||
emqx_resource:recreate(
|
emqx_resource:recreate_local(
|
||||||
?ID,
|
?ID,
|
||||||
?TEST_RESOURCE,
|
?TEST_RESOURCE,
|
||||||
#{name => test_resource},
|
#{name => test_resource},
|
||||||
|
@ -964,7 +964,7 @@ t_stop_start(_) ->
|
||||||
|
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
{ok, _},
|
{ok, _},
|
||||||
emqx_resource:check_and_recreate(
|
emqx_resource:check_and_recreate_local(
|
||||||
?ID,
|
?ID,
|
||||||
?TEST_RESOURCE,
|
?TEST_RESOURCE,
|
||||||
#{<<"name">> => <<"test_resource">>},
|
#{<<"name">> => <<"test_resource">>},
|
||||||
|
|
Loading…
Reference in New Issue