Rutgerdj
Rutgerdj
AEAsh Elixir
Created by Rutgerdj on 5/22/2025 in #support
Pubsub isolation in tests
I have a Phoenix application which has LiveView tests. When i run the tests in async mode the broadcasts from one test can interfere with other tests. What is the best way to handle this? Scenario: * Test 1 opens a live connection to a live_view which listens to broadcasts on a Ash resource * Test 2 performs an update on an object of the same resource. This causes a broadcast message because I've setup PubSub broadcasting on the resource * Test 1 now gets the broadcast update and crashes because it can't find that object The tests are already isolated through Postgres transactions. I was wondering if there was something similar for the PubSub server?
5 replies