-
Notifications
You must be signed in to change notification settings - Fork 134
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
disable global mock #159
Comments
Thanks for the report. Is there any way to access the code (or sample code) which I can reproduce the error? |
I don't have an open example but I think the issue can be easily reproduced by mocking some tests with exvcr but allowing other tests to make requests without mocks. Here's stacktrace I get: ** (EXIT) an exception was raised:
** (ArgumentError) argument error
:erlang.apply([], :options, [])
(exvcr 0.12.0) lib/exvcr/recorder.ex:71: ExVCR.Recorder.options/1
(exvcr 0.12.0) lib/exvcr/handler.ex:178: ExVCR.Handler.ignore_request?/2
(exvcr 0.12.0) lib/exvcr/handler.ex:17: ExVCR.Handler.get_response/2
(httpoison 1.7.0) lib/httpoison/base.ex:796: HTTPoison.Base.request/6 |
@ayrat555 thank you for the stack trace. I think I faced the same issue when I'd been working on the global mock. So I added the test for such case and was sure that this fixed. For a better understanding of the issue, could you check if it is the same when you run |
What is the reason for global mock? What problem does it solve? Can it be optional or turned off by default? |
Thank you for the information and analysis. |
parroty/exvcr#159 causes issues with other Mocks Signed-off-by: Thomas Citharel <[email protected]>
The global mock is an attempt to address a general issue with In general, every
Now it doesn't have such a flag but for sure it can be added. I understand that this maybe is critical for your application so I can suggest you switch back to I still believe that the issue can be fixed with the global mock. I'm currently trying to debug it but unfortunately no luck to get the same case. More information would help. For example, if you would run your tests with I don't want to lose an ability to speed up my tests so I can take a look at the flag that could enable the global mock as an experimental feature. |
Thank you for the detailed description.
Thank you for looking into this, I appreciate a lot. |
There is a PR to make global mock experimental and disabled by default #160 |
I have a similar error reported in #159 (comment) :erlang.apply([], :options, [])
(exvcr 0.12.1) lib/exvcr/handler.ex:30: ExVCR.Handler.get_response_from_cache/2
(exvcr 0.12.1) lib/exvcr/handler.ex:20: ExVCR.Handler.get_response/2
(httpoison 1.7.0) lib/httpoison/base.ex:796: HTTPoison.Base.request/6
(goth 1.2.0) lib/goth/client.ex:83: Goth.Client.get_access_token/3
(goth 1.2.0) lib/goth/token.ex:151: Goth.Token.retrieve_and_store!/2 from commit d757ad4 In addition to this, when I don't use the After recording the cassette I get ** (ExVCR.RequestNotMatchError) Request did not match with any one in the current cassette:
fixture/vcr_cassettes/fixture_30ca562f-c13c-40c7-8825-e22ce32fb692.json.
Delete the current cassette with [mix vcr.delete] and re-record.
Request: [:post, "url",
[{"Content-Type", "application/x-www-form-urlencoded"}],
{:form, [grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer",
assertion: "somepayload"], []] Any hints about this latter problem? |
@surik I'll try to see if I can re-produce the issue in a fresh repo. Tomorrow or the next week. Thanks for the quick reply! |
@surik here you go https://github.com/kpanic/global_mock |
@kpanic thank you for the test case. I think I found the issue with When we have iex(1)> ExVCR.Actor.CurrentRecorder.get()
[] But for bypassing cassettes as needed in your test case we expect a
I will fix it and also try to add a test case. The problem with not recording cassettes is not clear for me yet. I'm not sure if related to the above issue or it is something different. |
No worries about the latter problem. I might create a separate issue for that one |
Initial state should be `nil` to properly bypass mock when no cassette is used. See parroty#159 (comment)
Initial state should be `nil` to properly bypass mock when no cassette is used. See parroty#159 (comment)
I just updated my deps to the latest version, some tests started failing because instead of exvcr they use
fake_server
. is it possible to disable global mock?The text was updated successfully, but these errors were encountered: