소스 검색

test: move helper gc function to proper module

Thales Macedo Garitezi 1 년 전
부모
커밋
ba1898bea9
2개의 변경된 파일10개의 추가작업 그리고 7개의 파일을 삭제
  1. 9 1
      apps/emqx_cluster_link/src/emqx_cluster_link_extrouter_gc.erl
  2. 1 6
      apps/emqx_cluster_link/test/emqx_cluster_link_api_SUITE.erl

+ 9 - 1
apps/emqx_cluster_link/src/emqx_cluster_link_extrouter_gc.erl

@@ -9,7 +9,7 @@
 
 -export([start_link/0]).
 
--export([run/0]).
+-export([run/0, force/1]).
 
 -behaviour(gen_server).
 -export([
@@ -35,6 +35,14 @@ start_link() ->
 run() ->
     gen_server:call(?SERVER, run).
 
+force(Timestamp) ->
+    case emqx_cluster_link_extrouter:actor_gc(#{timestamp => Timestamp}) of
+        1 ->
+            force(Timestamp);
+        0 ->
+            ok
+    end.
+
 %%
 
 -record(st, {

+ 1 - 6
apps/emqx_cluster_link/test/emqx_cluster_link_api_SUITE.erl

@@ -234,12 +234,7 @@ disable_and_force_gc(TargetOrSource, Name, Params, TCConfig, Opts) ->
 
 do_actor_gc(Node, Timestamp) ->
     %% 2 Actors: one for normal routes, one for PS routes
-    case ?ON(Node, emqx_cluster_link_extrouter:actor_gc(#{timestamp => Timestamp})) of
-        1 ->
-            do_actor_gc(Node, Timestamp);
-        0 ->
-            ok
-    end.
+    ?ON(Node, emqx_cluster_link_extrouter_gc:force(Timestamp)).
 
 wait_for_routes([Node | Nodes], ExpectedTopics) ->
     Topics = ?ON(Node, emqx_cluster_link_extrouter:topics()),