Hi, I'm trying to build simple backend app with authentication and websockets. The goal is to have the ability for clients to create or join rooms and chat there with other connected clients - nothing complicated. Internally, I have multiple workers (lets say 100_000 supervised actors, ready to be used as room sessions) and a rooms manager, that can get or assign rooms to be used by clients and also send information about what rooms were created. I'm using wisp, mist and squirrel to make everything work, so i also add mist server and pog to a supervisor during app startup.
My brain is not braining when it comes to testing the app. The Context type is:
pub type Context {
Context(
conn: pog.Connection,
jwt_secret: String,
)
}
I already made some tests for authentication (with wisp/testing module), and I had two functions that I use before every test to create context:
mock_context() -> Contextfor tests that were not requiring any actualContextcontent.shutdown_context(handle_test: fn(Context) -> Nil)that handles opening db pool and then closing the pool after the test.
Now I need to expandContextcontent, by adding rooms manager's subject. I don't really know if it would make sense to start supervisor with all actors needed for each test, so im probably doing something wrong. I should probably start supervisor only once and then work with all proccesses i need (like db connection and manager subject), but i dont really know how to do it. I can't pass assigned names to tests functions during app start, so application's start module will not help me here...
I really hope my question makes sense, as I'm new to OTP and I'm figuring things out myself.