parroty / exvcr

HTTP request/response recording library for elixir, inspired by VCR.
MIT License
722 stars 132 forks source link

Annoying logs #92

Closed mrkaspa closed 7 years ago

mrkaspa commented 7 years ago

Is there a way to turn off these logs?

11:47:30.279 [error] Task #PID<0.2497.0> started from #PID<0.2495.0> terminating
** (ExVCR.RequestNotMatchError) Request did not match with any one in the current cassette: test/fixture/vcr_cassettes/geo_go_to_service.json.
Delete the current cassette with [mix vcr.delete] and re-record.

Request: [:post, "https://hooks.slack.com/services/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", [], {:form, [payload: "{\"text\":\"La tarea con ID 39310 esta en el estado arrived\\n\",\"channel\":\"#test_services\"}"]}, []]

    lib/exvcr/handler.ex:155: ExVCR.Handler.raise_error_if_cassette_already_exists/2
    lib/exvcr/handler.ex:137: ExVCR.Handler.get_response_from_server/2
    (hackney) :hackney.request(:post, "https://hooks.slack.com/services/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", [], {:form, [payload: "{\"text\":\"La tarea con ID 39310 esta en el estado arrived\\n\",\"channel\":\"#test_services\"}"]}, [])
    (httpoison) lib/httpoison/base.ex:402: HTTPoison.Base.request/9
    (elixir) lib/task/supervised.ex:85: Task.Supervised.do_apply/2
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Function: &HTTPoison.post/2
    Args: ["https://hooks.slack.com/services/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", {:form, [payload: "{\"text\":\"La tarea con ID 39310 esta en el estado arrived\\n\",\"channel\":\"#test_services\"}"]}]
11:47:30.280 [error] Task #PID<0.2496.0> started from #PID<0.2495.0> terminating
** (ExVCR.RequestNotMatchError) Request did not match with any one in the current cassette: test/fixture/vcr_cassettes/geo_go_to_service.json.
Delete the current cassette with [mix vcr.delete] and re-record.
parroty commented 7 years ago

deleting the 'test/fixture/vcr_cassettes/geo_go_to_service.json' and retry the test still show the error log?

mrkaspa commented 7 years ago

yes but this happens always, so if I record the calls is because I don't want to re-record them again everytime

parroty commented 7 years ago

Thanks for the info. Is there any way that I can see the recorded json and test code?

One possibility is certain parameter (of matching target) is changing on every request and failing to match.

Is there any options specified around the following? https://github.com/parroty/exvcr#recording-vcr-cassettes

mrkaspa commented 7 years ago

@parroty this is the cassete


[
  {
    "request": {
      "body": "",
      "headers": [],
      "method": "get",
      "options": [],
      "request_body": "",
      "url": "https://maps.googleapis.com/maps/api/distancematrix/json?destinations=cll+140+21+39%2C+Bogot%C3%A1%2C+Cundinamarca%2C+Colombia%7C%2C+&key=AIzaSyDwPQV9pRrMDK1AQKzzzR7xPbLaCgxOFrE&origins=%7C4.7238125%2C+-74.0489187"
    },
    "response": {
      "body": "{\n   \"destination_addresses\" : [ \"Cl. 140 #21-39, Bogotá, Colombia\", \"\" ],\n   \"origin_addresses\" : [ \"Cl. 140 #19A-36, Bogotá, Colombia\" ],\n   \"rows\" : [\n      {\n         \"elements\" : [\n            {\n               \"distance\" : {\n                  \"text\" : \"1 m\",\n                  \"value\" : 0\n               },\n               \"duration\" : {\n                  \"text\" : \"1 min\",\n                  \"value\" : 0\n               },\n               \"status\" : \"OK\"\n            },\n            {\n               \"status\" : \"NOT_FOUND\"\n            }\n         ]\n      }\n   ],\n   \"status\" : \"OK\"\n}\n",
      "headers": {
        "Content-Type": "application/json; charset=UTF-8",
        "Date": "Mon, 23 Jan 2017 21:41:20 GMT",
        "Expires": "Tue, 24 Jan 2017 21:41:20 GMT",
        "Cache-Control": "public, max-age=86400",
        "Server": "mafe",
        "X-XSS-Protection": "1; mode=block",
        "X-Frame-Options": "SAMEORIGIN",
        "Alt-Svc": "quic=\":443\"; ma=2592000; v=\"35,34\"",
        "Accept-Ranges": "none",
        "Vary": "Accept-Language,Accept-Encoding",
        "Transfer-Encoding": "chunked"
      },
      "status_code": 200,
      "type": "ok"
    }
  }
]
parroty commented 7 years ago

Thanks. It seems the cassette is having different endpoint response (maps.google.com) from the original one (hooks.slack.com).

Can you post the test code? (Any chance that different tests use the same name of cassette?)

Request: [:post, "https://hooks.slack.com/services/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", [], {:form, [payload: "{\"text\":\"La tarea con ID 39310 esta en el estado arrived\\n\",\"channel\":\"#test_services\"}"]}, []]
 "method": "get",
...
url": "https://maps.googleapis.com/maps/api/distancematrix/json?destinations=cll+140+21+39%2C+Bogot%C3%A1%2C+Cundinamarca%2C+Colombia%7C%2C+&key=AIzaSyDwPQV9pRrMDK1AQKzzzR7xPbLaCgxOFrE&origins=%7C4.7238125%2C+-74.0489187"
mrkaspa commented 7 years ago

Yes I could solve it, it looks like there is a request going out and it was not being recorded