You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thanks for creating this library! I really want to use it as I feel it would allow me to write tests that interact with external APIs more efficiently than with my current approach.
So right now I have a bunch of legacy tests for different REST APIs that use Bypass. My HTTP client is Tesla + Finch.
I wrote a test for a new API using ExVcr. When I run the ExVcr test asynchronously together with the other async Bypass-based tests, some of the Bypass tests always fail. Which tests exactly fail is random and depends on the order of execution I guess. If I run the ExVcr test with async: false everything is fine.
What could be the reason behind this issue? My understanding is that ExVcr mocks the functions in the Finch module. Are these mocks global? If that's the case then it's no surprise that the other async Bypass-based tests occasionally fail, because they need to hit the real Finch implementation to talk to the Bypass server.
Am I right in this assumption? If so, is there a way to restrict the mocks to the current test only, so that other tests running in parallel will use the real implementation?
Thanks. I tried but it doesn't work. And it makes sense: the tests are running concurrently, so clearing the mocks after a test doesn't guarantee in any way that another test running concurrently won't use the mocks
First of all, thanks for creating this library! I really want to use it as I feel it would allow me to write tests that interact with external APIs more efficiently than with my current approach.
What is my current approach? I use Bypass.
So right now I have a bunch of legacy tests for different REST APIs that use Bypass. My HTTP client is Tesla + Finch.
I wrote a test for a new API using ExVcr. When I run the ExVcr test asynchronously together with the other async Bypass-based tests, some of the Bypass tests always fail. Which tests exactly fail is random and depends on the order of execution I guess. If I run the ExVcr test with
async: false
everything is fine.What could be the reason behind this issue? My understanding is that ExVcr mocks the functions in the Finch module. Are these mocks global? If that's the case then it's no surprise that the other async Bypass-based tests occasionally fail, because they need to hit the real Finch implementation to talk to the Bypass server.
Am I right in this assumption? If so, is there a way to restrict the mocks to the current test only, so that other tests running in parallel will use the real implementation?
this is the preamble of my test file:
I have no global config for ExVCR.
For Tesla I have this in my config:
And I start the Finch process with this child spec in my
application.ex
:(All very standard as you can see)
The text was updated successfully, but these errors were encountered: