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

Make all the logging when running some faraday in test not pollute the output... #964

Closed
epugh opened this issue Feb 27, 2024 · 4 comments
Closed

Comments

@epugh
Copy link
Member

epugh commented Feb 27, 2024

Describe the bug
When I run:

bin/docker r rails test test/controllers/proxy_controller_test.rb

We test out various error situations... Which dumps in the logs;


I, [2024-02-27T22:36:46.261283 #1]  INFO -- request: GET http://solr.quepid.com:8983/solr/statedecoded/select?fl=id%2Ctext&q=I+like+%3F+marks%2C+do+you+like+%3F+marks%3F&rows=10&start=01
I, [2024-02-27T22:36:46.264073 #1]  INFO -- response: Status 200
I, [2024-02-27T22:36:46.275638 #1]  INFO -- request: GET http://solr.quepid.com:8983/solr/statedecoded/select?fl=id%2Ctext&q=tiger%3F&rows=10&start=0 ] 46% Time: 00:00:00,  ETA: 00:00:01
I, [2024-02-27T22:36:46.278638 #1]  INFO -- response: Status 200
I, [2024-02-27T22:36:46.289099 #1]  INFO -- request: GET http://solr.quepid.com:8983/solr/statedecoded/select?fl=id%2Ctext&q=can+I+own+a+tiger&rows=10&start=0me: 00:00:00,  ETA: 00:00:01
I, [2024-02-27T22:36:46.291713 #1]  INFO -- response: Status 200
I, [2024-02-27T22:36:46.302922 #1]  INFO -- request: GET http://solr.quepid.com:8983/solr/statedecoded/select?fl=id%2Ctext&q=legal&rows=10&start=0    ] 61% Time: 00:00:00,  ETA: 00:00:00
I, [2024-02-27T22:36:46.304522 #1]  INFO -- response: Status 200
I, [2024-02-27T22:36:46.342640 #1]  INFO -- request: GET https://example.com/old-url===========================================                       ] 84% Time: 00:00:00,  ETA: 00:00:00
I, [2024-02-27T22:36:46.344114 #1]  INFO -- response: Status 302
I, [2024-02-27T22:36:46.344364 #1]  INFO -- request: GET https://example.com/new-location
I, [2024-02-27T22:36:46.345451 #1]  INFO -- response: Status 200
I, [2024-02-27T22:36:46.356076 #1]  INFO -- request: GET https://localhost:9999/==========================================================            ] 92% Time: 00:00:00,  ETA: 00:00:00
I, [2024-02-27T22:36:46.357356 #1]  INFO -- error: /usr/local/bundle/gems/webmock-3.19.1/lib/webmock/response.rb:71:in `raise_error_if_any': Failed to connect (Faraday::ConnectionFailed)
	from /usr/local/bundle/gems/webmock-3.19.1/lib/webmock/http_lib_adapters/net_http.rb:168:in `build_net_http_response'
	from /usr/local/bundle/gems/webmock-3.19.1/lib/webmock/http_lib_adapters/net_http.rb:80:in `request'
	from /usr/local/bundle/gems/faraday-net_http-3.1.0/lib/faraday/adapter/net_http.rb:113:in `block in request_with_wrapped_block'
	from /usr/local/bundle/gems/webmock-3.19.1/lib/webmock/http_lib_adapters/net_http.rb:116:in `start_without_connect'
	from /usr/local/bundle/gems/webmock-3.19.1/lib/webmock/http_lib_adapters/net_http.rb:143:in `start'
	from /usr/local/bundle/gems/faraday-net_http-3.1.0/lib/faraday/adapter/net_http.rb:112:in `request_with_wrapped_block'
	from /usr/local/bundle/gems/faraday-net_http-3.1.0/lib/faraday/adapter/net_http.rb:102:in `perform_request'

I can't figure out if the right thing is to log the error, or should they be swallowed cause it's not quepid fault that it can't proxy a request...

curl 'http://localhost:3000/proxy/fetch?url=https://somefakeserver.that.doesnot.exist.com:9200' -X POST -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:123.0) Gecko/20100101 Firefox/123.0' -H 'Accept: application/json, text/plain, /' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br' -H 'Referer: http://localhost:3000/case/6797/try/1?showWizard=true&sort=default' -H 'Content-Type: application/json;charset=utf-8' -H 'Origin: http://localhost:3000' -H 'Connection: keep-alive' -H 'Cookie: _ga=GA1.1.614557631.1698408169; ahoy_visitor=29cf7292-9e33-4b28-bfef-cd763ca05ee1; _ga_BQV14XK08F=GS1.1.1708634197.4.1.1708637057.0.0.0; _quepid_session=mgkksQwFUVCx9c2DyONXrDtMrU%2FDdZWZDKncz4qbVcUQQ6EwSZcKFW%2F%2FKK%2B7RHj7hHraO9PT8ovRZf91UayRbZXQyjroPWsnVstGzxlE7Mj89%2BdSxaaFxiGPNbfDVTqSyKLS0PHywkZ7jfj9bN%2FhzJq8MWIipZjZGiT0c3ddCn5XGFxk%2Bp7GcbNdBCZchavJI2WSKKWvxmNlvgLvlbqJ154ObJ%2B2IwesL39fJ5RI6mYIADkH%2FUQEXFqTD2XGTiUcODS5g8aN5lycKQg3eyJPYf8iDYjQTF%2BD4VfhG7f%2B7N7QWJ0V0WF2FfZ2YUotxjg%3D--W1DkFQtgP89ZVeaY--9xelvF0%2B7lCO6Z7cuLfB1Q%3D%3D; __profilin=p%3Dt' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: no-cors' -H 'Sec-Fetch-Site: same-origin' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' --data-raw $'{\n "query": "QUERY_THAT_MATCHES_AT_LEAST_ONE_DOC"\n}'

@epugh
Copy link
Member Author

epugh commented Feb 27, 2024

@reid-rigo I would love your input on how to handle this...

@reid-rigo
Copy link
Contributor

@epugh I think something like this would make sense on the Faraday client:

faraday.response :logger, nil, { headers: proxy_debug, bodies: proxy_debug, errors: !Rails.env.test? }

@epugh
Copy link
Member Author

epugh commented Mar 12, 2024

Yeah... I sometimes, when have a new feature to Quepid want lots of debugging "just because" and then over time as I become more comfortable with it, start turning off debugging. Thats why right now all the faraday stuff gets dumped to disk... I think you are right.....

@epugh
Copy link
Member Author

epugh commented Mar 15, 2024

Fixed in #983

@epugh epugh closed this as completed Mar 15, 2024
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