supabase-flutter icon indicating copy to clipboard operation
supabase-flutter copied to clipboard

Support multiple, separate, instances of `Supabase` in a single application

Open FelixZY opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe. I'm writing integration tests where I want to make calls to a local Supabase instance running on my test machine. My current problem is that I can only use a single instance of Supabase, making it impossible to maintain test isolation since Dart runs tests in parallel.

Example: Test A signs out while test B is updating the user profile.

Describe the solution you'd like I would like to be able to create multiple, parallel instances of Supabase, targeting different user profiles. This would make it possible to make different tests use different user profiles (e.g. [email protected] and [email protected]) and run (at least some) tests in parallel.

I don't think this solves my specific problem completely but it would at least provide a workaround.

Describe alternatives you've considered Running my tests serially. Definitely slower and perhaps not even supported at this time.

Additional context https://stackoverflow.com/questions/75348775/how-to-run-tests-in-series-in-flutter

FelixZY avatar Feb 04 '23 22:02 FelixZY

I don't think this solves my specific problem completely but it would at least provide a workaround.

Actually, it might. If it was possible to create multiple Supabase instances that could be used in parallel, then each instance could potentially hold its own session for a single test user. Even if one session was signed out as part of a test, that would not affect other tests running under the "same" user in parallel.

FelixZY avatar Feb 04 '23 22:02 FelixZY

Sorry, for one year long no response. I don't think multiple Supabase instances would solve the test parallel issue. At least pure Dart tests are run in parallel, but I'm pretty sure they don't share memory so many Supabase instances can exist in parallel. What's the exact issue you were facing? Or the other people reacting to this issue. I guess the issue is that they all use the same backend.

Vinzent03 avatar Mar 12 '24 23:03 Vinzent03