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

chore(deps-dev): bump webmock from 3.18.1 to 3.19.1 #11470

Merged
merged 4 commits into from
Jan 14, 2024

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Aug 30, 2023

Bumps webmock from 3.18.1 to 3.19.1.

Changelog

Sourced from webmock's changelog.

Changelog

3.19.0

  • When passing a Proc or lambda as response body to to_return_json, the body is evaluated at the time of request and not at the time of to_return_json method invocation.

    Thanks to Jason Karns for reporting.

  • Do not alter real (non-stubbed) request headers when handling em-http-request requests.

    Thanks to Yoann Lecuyer

  • Fix matching stubs with HashExcludingMatcher

    Thanks to Lucas Arnaud

  • Remove development and test files from the gem package

    Thanks to Orien Madgwick

  • Fix supported http client gem version checks.

    Thanks to Marc Rohloff and Roman Stražanec

  • Non-string body passed to #to_return_json is now converted to JSON string.

    Thanks to inkstak

  • [::1] is recognised as localhost e.g when passing allow_localhost option to disable_net_connect!

    Thanks to Yuki Inoue

  • Optimized normalize_headers for performance

    Thanks to Brandon Weaver

  • Added Frozen string literal to files to optimise memory usage

    Thanks to Josh Nichols

Commits
  • f5726d6 Version 3.19.1
  • 8401c6e When passing lambda as body, to to_return_json, it is evaluated at the time o...
  • d707719 Version 3.19.0
  • 9305ab5 Merge pull request #1033 from technicalpickles/frozen-string-literal
  • d4afbd9 Merge pull request #1029 from baweaver/baweaver/performance/normalize_headers...
  • 19917a3 Merge pull request #1030 from Yuki-Inoue/master
  • d933001 Merge pull request #1012 from inkstak/feature-to_return_json_accepts_array_body
  • 0d422a1 Merge pull request #1026 from baweaver/patch-2
  • 87786a2 Merge pull request #1006 from marcrohloff/fix-version-checking
  • 0e9519c Merge branch 'master' into fix-version-checking
  • Additional commits viewable in compare view

Dependabot compatibility score

You can trigger a rebase of this PR by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Note
Automatic rebases have been disabled on this pull request as it has been open for over 30 days.

@dependabot dependabot bot added dependencies ruby Pull requests that update Ruby code labels Aug 30, 2023
@mkllnk
Copy link
Member

mkllnk commented Aug 30, 2023

The changelog and code change looks good but there are failing specs. Maybe it's some inter-gem incompatibility. Needs investigating.

@jibees jibees force-pushed the dependabot/bundler/webmock-3.19.1 branch from 7703dad to 7ecf43a Compare September 5, 2023 08:35
@jibees jibees self-assigned this Sep 5, 2023
@jibees jibees force-pushed the dependabot/bundler/webmock-3.19.1 branch 2 times, most recently from 380e559 to 8a8099b Compare September 5, 2023 12:04
@jibees
Copy link
Contributor

jibees commented Sep 5, 2023

I'm still struggling with spec/views/spree/admin/orders/invoice.html.haml_spec.rb having:


  6) spree/admin/orders/invoice.html.haml displays order note on invoice when note is given
     Failure/Error: wicked_pdf_stylesheet_pack_tag(source)
     
     ActionView::Template::Error:
       Failed to open TCP connection to test.host:80 (getaddrinfo: nodename nor servname provided, or not known)
     # ./app/helpers/application_helper.rb:68:in `pdf_stylesheet_pack_tag'
     # ./app/views/spree/admin/orders/invoice.html.haml:1:in `_app_views_spree_admin_orders_invoice_html_haml___492743944877852268_47420'
     # ./spec/views/spree/admin/orders/invoice.html.haml_spec.rb:93:in `block (2 levels) in <top (required)>'
     # ------------------
     # --- Caused by: ---
     # SocketError:
     #   getaddrinfo: nodename nor servname provided, or not known
     #   ./app/helpers/application_helper.rb:68:in `pdf_stylesheet_pack_tag'

even if ignoring host test.host with VCR.

I'm blocked.

@jibees jibees added the blocked label Sep 5, 2023
Copy link
Member

@mkllnk mkllnk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found a solution. 😄

Comment on lines 30 to 33
stub_request(:get, ->(uri) { uri.to_s.include? "/css/mail" })
# Ignore requests for CSS pack like: 'http://test.host/packs-test/css/mail-1ab2dc7f.css'
VCR.configure do |config|
config.ignore_hosts('test.host')
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the rendering is trying to access CSS in test.host. Configuring VCR to ignore that request just means that it's still handled by Webmock and it doesn't allow external requests. Well, since test.host is not a valid domain name, it fails resolving it. The original stub solved this by intercepting the request and not returning anything.

So when we have the stub in there, we get the frozen string error but the stack trace is limited to our code. I put a binding.pry in front of that line and called wicked_pdf_stylesheet_pack_tag(source) within the console which revealed the same error but now pointing to the source:

https://github.com/mileszs/wicked_pdf/blob/edcd80e7a96b5fe79476f7984e5ff8f3765f220d/lib/wicked_pdf/wicked_pdf_helper/assets.rb#L191-L192

Wicked PDF tries to read the URL and gets a string. But that string is provided by Webmock. It tries to force the encoding on the string which would modify it but it's not allowed to because Webmock is using a frozen string in this new version.

I tried defining the returned string but it's frozen by default because we add frozen_string_literal: true at the top of our files. A workaround is to duplicate it to a non-frozen string:

    stub_request(:get, ->(uri) { uri.to_s.include? "/css/mail" }).to_return(body: "".dup)

This works. And we don't need to ignore the host in VCR. I reckon that this should be fixed in wicked_pdf but webmock could also be patched to be compatible with this.

I think this commit introduced it:

Maybe it's this line that could be changed:

https://github.com/bblimke/webmock/blob/63940ac95345968cf435820a62102d913441862c/lib/webmock/response.rb#L40-L42

Patching Webmock works but I'm not sure if they would accept my patch. So we should go with our workaround for now, especially because it's only needed in combination with wicked_pdf.

@mkllnk mkllnk removed the blocked label Sep 7, 2023
@jibees jibees removed their assignment Sep 21, 2023
dependabot bot and others added 3 commits January 8, 2024 16:54
Bumps [webmock](https://github.com/bblimke/webmock) from 3.18.1 to 3.19.1.
- [Changelog](https://github.com/bblimke/webmock/blob/master/CHANGELOG.md)
- [Commits](bblimke/webmock@v3.18.1...v3.19.1)

---
updated-dependencies:
- dependency-name: webmock
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
```
Failed to open TCP connection to test.host:80
```
@rioug rioug force-pushed the dependabot/bundler/webmock-3.19.1 branch from 8a8099b to 9ea6fc0 Compare January 8, 2024 05:54
@rioug rioug self-assigned this Jan 8, 2024
Copy link
Member

@mkllnk mkllnk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, finally. Thank you!

@mkllnk mkllnk merged commit 3431f89 into master Jan 14, 2024
52 checks passed
@mkllnk mkllnk deleted the dependabot/bundler/webmock-3.19.1 branch January 14, 2024 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies ruby Pull requests that update Ruby code
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants