Skip to content

Test failures since webmock 3.25.2 #1118

@voxik

Description

@voxik

Since webmock 3.25.2, I observe the following test failure (this is shared test, so I actually hit the same issue 5x):

$ rspec spec/acceptance/curb/curb_spec.rb[2:5:1:1:1:4:3:1:4]
No network connectivity. Only examples which do not make real network connections will run.
Run options:
  include {focus: true, ids: {"./spec/acceptance/curb/curb_spec.rb" => ["2:5:1:1:1:4:3:1:4"]}}
  exclude {without_webmock: true, net_connect: true}
F

Failures:

  1) Webmock with Curb using .perform for requests it should behave like Curb with WebMock when net connect is not allowed, with exceptions allowing by scheme:host string when the host and scheme is not allowed should raise exception if request was made to different scheme
     Failure/Error: example.run
     
       expected WebMock::NetConnectNotAllowedError with message matching /Real HTTP connections are disabled. Unregistered request: GET https:\/\/httpstat.us/, got #<Curl::Err::HostResolutionError: Could not resolve hostname: Could not resolve host: httpstat.us> with backtrace:
         # /usr/share/gems/gems/curb-1.0.5/lib/curl/easy.rb:80:in 'Curl::Easy#perform'
         # ./lib/webmock/http_lib_adapters/curb_adapter.rb:274:in 'block in Curl::WebMockCurlEasy#perform'
         # ./lib/webmock/http_lib_adapters/curb_adapter.rb:70:in 'Curl::WebMockCurlEasy#curb_or_webmock'
         # ./lib/webmock/http_lib_adapters/curb_adapter.rb:274:in 'Curl::WebMockCurlEasy#perform'
         # ./lib/webmock/http_lib_adapters/curb_adapter.rb:248:in 'Curl::Easy#http'
         # ./lib/webmock/http_lib_adapters/curb_adapter.rb:248:in 'Curl::WebMockCurlEasy#http'
         # /usr/share/gems/gems/curb-1.0.5/lib/curl/easy.rb:303:in 'Curl::Easy#http_get'
         # ./lib/webmock/http_lib_adapters/curb_adapter.rb:254:in 'block (2 levels) in <class:WebMockCurlEasy>'
         # /usr/share/gems/gems/curb-1.0.5/lib/curl/easy.rb:353:in 'Curl::Easy.http_get'
         # /builddir/build/BUILD/rubygem-webmock-3.26.1-build/spec/acceptance/curb/curb_spec_helper.rb:132:in 'CurbSpecHelper::ClassPerform#curb_http_request'
         # /builddir/build/BUILD/rubygem-webmock-3.26.1-build/spec/acceptance/curb/curb_spec_helper.rb:8:in 'CurbSpecHelper#http_request'
         # /builddir/build/BUILD/rubygem-webmock-3.26.1-build/spec/acceptance/shared/allowing_and_disabling_net_connect.rb:190:in 'block (7 levels) in <top (required)>'
         # /builddir/build/BUILD/rubygem-webmock-3.26.1-build/spec/acceptance/shared/allowing_and_disabling_net_connect.rb:191:in 'block (6 levels) in <top (required)>'
         # ./lib/webmock/rspec.rb:39:in 'block (2 levels) in <top (required)>'
     Shared Example Group: "allowing and disabling net connect" called from /builddir/build/BUILD/rubygem-webmock-3.26.1-build/spec/acceptance/webmock_shared.rb:26
     Shared Example Group: "with WebMock" called from ./spec/acceptance/curb/curb_spec.rb:10
     Shared Example Group: "Curb" called from ./spec/acceptance/curb/curb_spec.rb:484
     # /builddir/build/BUILD/rubygem-webmock-3.26.1-build/spec/acceptance/shared/allowing_and_disabling_net_connect.rb:191:in 'block (6 levels) in <top (required)>'
     # ./lib/webmock/rspec.rb:39:in 'block (2 levels) in <top (required)>'

Finished in 0.13499 seconds (files took 5.39 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/acceptance/curb/curb_spec.rb[2:5:1:1:1:4:3:1:4] # Webmock with Curb using .perform for requests it should behave like Curb with WebMock when net connect is not allowed, with exceptions allowing by scheme:host string when the host and scheme is not allowed should raise exception if request was made to different scheme

I can workaround this issue by:

$ HTTP_STATUS_SERVICE="http://httpstatus" rspec spec/acceptance/curb/curb_spec.rb[2:5:1:1:1:4:3:1:4]
No network connectivity. Only examples which do not make real network connections will run.
Run options:
  include {focus: true, ids: {"./spec/acceptance/curb/curb_spec.rb" => ["2:5:1:1:1:4:3:1:4"]}}
  exclude {without_webmock: true, net_connect: true}
.

Finished in 0.13057 seconds (files took 5.34 seconds to load)
1 example, 0 failures

The same env variable is set in GH actions indeed, so this is likely hidden.

Most probably, this is result of 6d2be29, but I still can't wrap my head around. Why the only one (shared) test fails? Why it would not pass with defaults?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions