@@ -100,7 +100,6 @@ defmodule Realtime.Tenants.ReplicationConnectionTest do
100100 "event" => "INSERT" ,
101101 "meta" => % { "id" => row . id } ,
102102 "payload" => % {
103- "id" => row . id ,
104103 "value" => value
105104 } ,
106105 "type" => "broadcast"
@@ -142,7 +141,6 @@ defmodule Realtime.Tenants.ReplicationConnectionTest do
142141 "event" => "INSERT" ,
143142 "meta" => % { "id" => id } ,
144143 "payload" => % {
145- "id" => id ,
146144 "value" => ^ value
147145 }
148146 } ,
@@ -231,83 +229,6 @@ defmodule Realtime.Tenants.ReplicationConnectionTest do
231229 assert logs =~ "UnableToBroadcastChanges: %{messages: [%{payload: [\" Payload size exceeds tenant limit\" ]}]}"
232230 end
233231
234- test "payload without id" , % { tenant: tenant } do
235- start_link_supervised! (
236- { ReplicationConnection , % ReplicationConnection { tenant_id: tenant . external_id , monitored_pid: self ( ) } } ,
237- restart: :transient
238- )
239-
240- topic = random_string ( )
241- tenant_topic = Tenants . tenant_topic ( tenant . external_id , topic , false )
242- subscribe ( tenant_topic , topic )
243-
244- fixture =
245- message_fixture ( tenant , % {
246- "topic" => topic ,
247- "private" => true ,
248- "event" => "INSERT" ,
249- "payload" => % { "value" => "something" }
250- } )
251-
252- fixture_id = fixture . id
253-
254- assert_receive { :socket_push , :text , data } , 500
255- message = data |> IO . iodata_to_binary ( ) |> Jason . decode! ( )
256-
257- assert % {
258- "event" => "broadcast" ,
259- "payload" => % {
260- "event" => "INSERT" ,
261- "meta" => % { "id" => ^ fixture_id } ,
262- "payload" => payload ,
263- "type" => "broadcast"
264- } ,
265- "ref" => nil ,
266- "topic" => ^ topic
267- } = message
268-
269- assert payload == % {
270- "value" => "something" ,
271- "id" => fixture_id
272- }
273- end
274-
275- test "payload including id" , % { tenant: tenant } do
276- start_link_supervised! (
277- { ReplicationConnection , % ReplicationConnection { tenant_id: tenant . external_id , monitored_pid: self ( ) } } ,
278- restart: :transient
279- )
280-
281- topic = random_string ( )
282- tenant_topic = Tenants . tenant_topic ( tenant . external_id , topic , false )
283- subscribe ( tenant_topic , topic )
284-
285- payload = % { "value" => "something" , "id" => "123456" }
286-
287- % { id: fixture_id } =
288- message_fixture ( tenant , % {
289- "topic" => topic ,
290- "private" => true ,
291- "event" => "INSERT" ,
292- "payload" => payload
293- } )
294-
295- assert_receive { :socket_push , :text , data } , 500
296- message = data |> IO . iodata_to_binary ( ) |> Jason . decode! ( )
297-
298- assert % {
299- "event" => "broadcast" ,
300- "payload" => % {
301- "meta" => % { "id" => ^ fixture_id } ,
302- "event" => "INSERT" ,
303- "payload" => ^ payload ,
304- "type" => "broadcast"
305- } ,
306- "ref" => nil ,
307- "topic" => ^ topic
308- } = message
309- end
310-
311232 test "fails on existing replication slot" , % { tenant: tenant } do
312233 { :ok , db_conn } = Database . connect ( tenant , "realtime_test" , :stop )
313234 name = "supabase_realtime_messages_replication_slot_test"
0 commit comments