Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating tenant in tests #67

Closed
0urobor0s opened this issue Mar 25, 2019 · 4 comments
Closed

Creating tenant in tests #67

0urobor0s opened this issue Mar 25, 2019 · 4 comments

Comments

@0urobor0s
Copy link

Saw #61 but I still get an error
{:error, "connection not available and request was dropped from queue after XXms. You can configure how long requests wait in the queue using :queue_target and :queue_interval. See DBConnection.start_link/2 for more information"}
For context I'm calling Triplex.create inside the test.

@churcho
Copy link

churcho commented Mar 26, 2019

Try the option described here

That worked for me.

I decided to ignore tests to check if Triplex.create works because that's essentially testing the module again.

@0urobor0s
Copy link
Author

Yes, for the first tenant creation that works, the problem is that the application needs to create a tenant on demand from a request. That's what I'm testing.

@churcho
Copy link

churcho commented Mar 26, 2019

Same issue I had.

I just resolved that "If it can make one, it can make another if I pass the right params" so instead of testing Tenant.create, I test my logic that handles that request.

It's sort of like testing GenServer calls and not the entire GenServer process. I know it's limiting but it works.

@0urobor0s
Copy link
Author

After seeing how Ecto.Adapters.SQL.Sandbox works I figured how to run the tests I wanted.
The solution was to tag the test as async: false and in the setup of said test using :ok = Ecto.Adapters.SQL.Sandbox.mode(MyApp.Repo, :auto)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants