@@ -6,7 +6,6 @@ defmodule Realtime.Tenants.ReplicationConnection.WatchdogTest do
66 import ExUnit.CaptureLog
77
88 alias Realtime.Database
9- alias Realtime.FeatureFlags
109 alias Realtime.Tenants.Connect
1110 alias Realtime.Tenants.ReplicationConnection.Watchdog
1211
@@ -159,7 +158,6 @@ defmodule Realtime.Tenants.ReplicationConnection.WatchdogTest do
159158 end
160159
161160 test "continues when slot lag is below threshold" , % { fake_pid: fake_pid } do
162- stub ( FeatureFlags , :enabled? , fn _flag , _tenant -> true end )
163161 stub ( Connect , :get_status , fn _tenant_id -> { :ok , :fake_conn } end )
164162 stub ( Database , :check_replication_slot_lag , fn _conn , _slot -> :ok end )
165163
@@ -173,7 +171,6 @@ defmodule Realtime.Tenants.ReplicationConnection.WatchdogTest do
173171 replication_slot_name: "test_slot" }
174172 )
175173
176- Mimic . allow ( FeatureFlags , self ( ) , watchdog_pid )
177174 Mimic . allow ( Connect , self ( ) , watchdog_pid )
178175 Mimic . allow ( Database , self ( ) , watchdog_pid )
179176
@@ -183,7 +180,6 @@ defmodule Realtime.Tenants.ReplicationConnection.WatchdogTest do
183180 end
184181
185182 test "stops with :slot_lag_too_high when lag exceeds threshold" , % { fake_pid: fake_pid } do
186- stub ( FeatureFlags , :enabled? , fn _flag , _tenant -> true end )
187183 stub ( Connect , :get_status , fn _tenant_id -> { :ok , :fake_conn } end )
188184 stub ( Database , :check_replication_slot_lag , fn _conn , _slot -> { :error , :lag_too_high } end )
189185
@@ -199,7 +195,6 @@ defmodule Realtime.Tenants.ReplicationConnection.WatchdogTest do
199195 replication_slot_name: "test_slot" }
200196 )
201197
202- Mimic . allow ( FeatureFlags , self ( ) , watchdog_pid )
203198 Mimic . allow ( Connect , self ( ) , watchdog_pid )
204199 Mimic . allow ( Database , self ( ) , watchdog_pid )
205200
@@ -211,7 +206,6 @@ defmodule Realtime.Tenants.ReplicationConnection.WatchdogTest do
211206 end
212207
213208 test "continues when DB connection is unavailable (graceful degradation)" , % { fake_pid: fake_pid } do
214- stub ( FeatureFlags , :enabled? , fn _flag , _tenant -> true end )
215209 stub ( Connect , :get_status , fn _tenant_id -> { :error , :tenant_database_unavailable } end )
216210
217211 logs =
@@ -226,7 +220,6 @@ defmodule Realtime.Tenants.ReplicationConnection.WatchdogTest do
226220 replication_slot_name: "test_slot" }
227221 )
228222
229- Mimic . allow ( FeatureFlags , self ( ) , watchdog_pid )
230223 Mimic . allow ( Connect , self ( ) , watchdog_pid )
231224
232225 Process . sleep ( 120 )
@@ -236,26 +229,5 @@ defmodule Realtime.Tenants.ReplicationConnection.WatchdogTest do
236229
237230 assert logs =~ "ReplicationSlotLagCheckSkipped"
238231 end
239-
240- test "skips lag check when feature flag is disabled" , % { fake_pid: fake_pid } do
241- stub ( FeatureFlags , :enabled? , fn _flag , _tenant -> false end )
242- reject ( & Database . check_replication_slot_lag / 2 )
243-
244- watchdog_pid =
245- start_supervised! (
246- { Watchdog ,
247- parent_pid: fake_pid ,
248- tenant_id: "lag-test" ,
249- watchdog_interval: 50 ,
250- watchdog_timeout: 100 ,
251- replication_slot_name: "test_slot" }
252- )
253-
254- Mimic . allow ( FeatureFlags , self ( ) , watchdog_pid )
255-
256- Process . sleep ( 120 )
257-
258- assert Process . alive? ( watchdog_pid )
259- end
260232 end
261233end
0 commit comments