Comments (8)
Thanks for the extensive report and analysis, the 3 points you mentioned makes sense. Is there any ways you can try (or provide sample code?). If you can provide PR, that would be great too, though.
from exvcr.
I tried extracting something isolated and failed, sadly, so there's something going on I don't understand and I can't really provide you with our entire codebase. I'll keep an eye out to see if it happens again and can extract something at that time.
from exvcr.
Hi there,
@myronmarston Have you found a workaround to this issue ?
On my project, it's happening when I have a GenServer handle_call
or handle_cast
spawning a process that will have to to an HTTP request to HTTPoison, faked by ExVCR. And same as @myronmarston it's happening randomly.
For now, I do a try catch on that error to having it removed to the tests. But that's not a solution :
spawn(fn ->
try do
function_using_http_poison
rescue
e in HTTPoison.Error ->
nil
end
from exvcr.
@myronmarston Have you found a workaround to this issue ?
Nope.
from exvcr.
I'm having the same problem when using HTTPoison.
from exvcr.
Something similar to #53 it happens when we have multiple requests in the test suite. Using HTTPoison and same issue.
from exvcr.
i have a similar issue with parallel requests being made #127 (sorry i just found this issue), i think both are related. i also added a minimum code sample of what i'm doing.
from exvcr.
It seems that network calls from spawned processes are not mocked at all. Upon switching off my wifi and running this test when a cassette is already populated, I receive an error which indicates the cassette was ignored and that it tried to make a network request.
The behaviour was the same even after turning on the global_mock config
defmodule Api.SomeTest.Test do
use ExUnit.Case, async: false
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
test "can get" do
parent_pid = self()
use_cassette "get_example_dotcom" do
Process.spawn(
fn ->
res = HTTPoison.get("https://example.com")
send(parent_pid, res)
end,
[:link]
)
end
assert_receive {:ok, %{status_code: 200}}, 5000
end
end
1) test can get (Api.SomeTest.Test)
test/api/get_example_test.exs:5
Assertion failed, no matching message after 5000ms
Showing 1 of 1 message in the mailbox
code: assert_receive {:ok, %{status_code: 200}}
mailbox:
pattern: {:ok, %{status_code: 200}}
value: {:error, %HTTPoison.Error{__exception__: true, id: nil, reason: :nxdomain}}
stacktrace:
test/api/get_example_test.exs:18: (test)
Finished in 5.1 seconds (0.00s async, 5.1s sync)
1 test, 1 failure
from exvcr.
Related Issues (20)
- Request was made? HOT 1
- ExVCR.IEx not working with adapter: ExVCR.Adapter.Hackney HOT 2
- disable global mock HOT 14
- Global Mock does not use cassettes with HTTPoison HOT 2
- How to use ExVCR with Finch? HOT 3
- Filter sensitive data after all request made HOT 1
- Support `mix vcr.check --include mytag` ?
- Can't match json response bodies for removing sensitive data? HOT 1
- Cassettes are not injected after test cases! HOT 1
- ** (ArgumentError) argument error
- Support for Finch 0.9.x? HOT 1
- Feature request: `start_cassette` and `stop_cassette`
- Same as vcr request: save response json body with more formatting HOT 1
- Generated custom_cassettes with patchfile HOT 1
- Wrong responses when HTTPoison is used from async Task HOT 4
- Async tests using Bypass interfere with ExVcr tests HOT 3
- support httpoison 2.0 HOT 1
- Version `0.14.0` cannot be compiled in projects not using `Finch`
- Unable to record when specifying a receive_timeout option
- Long list of warnings on Elixir 1.16 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from exvcr.