I’ve upgraded an Phoenix 1.1.4 app to use Ecto 2.0 and wanted to try adding acceptance tests before upgrading to 1.2. I followed the instructions in the Wallaby repo and got concurrent tests going with the Phoenix.Ecto.SQL.Sandbox
plug. However I’ve run into a problem I’m not sure how to solve other than by switching back to sequential tests.
The page my acceptance tests loads connects to a channel (UserChannel), and in the authorized?
function there I query the database as part of authorisation. This triggers a ** (RuntimeError) cannot find ownership process for #PID<0.xxx.0>
. I assume this is because of the way the the process handling the channel is started?
The web request and the websocket request both have the extra metadata in the UA string that phoenix_ecto uses to allow them access to the connection but I don’t see how to pass this through to the created channel processes.
My app starts or finds a named GenServer when a channel is joined, and that also talks to the database to manage state. Is there a way I can add this process to the ones allowed access to the connection too?
For now I’ve set async: false
and put the Repo into shared mode.