Skip to content

Fix WebMock::NetConnectNotAllowedError spec failure

Dmitry Gruzd requested to merge 207531-fix-spec-failure into master

What does this MR do?

This is a fix for master:broken #207531 (closed)

rspec ./spec/views/admin/application_settings/integrations.html.haml_spec.rb:17 # admin/application_settings/integrations.html.haml sourcegraph integration when sourcegraph feature is enabled show the form
 rspec ./spec/views/admin/application_settings/integrations.html.haml_spec.rb:27 # admin/application_settings/integrations.html.haml sourcegraph integration when sourcegraph feature is disabled show the form
Failures:
   1) admin/application_settings/integrations.html.haml sourcegraph integration when sourcegraph feature is enabled show the form
      Failure/Error: render(partial, locals) if partial_exists?(partial)
      WebMock::NetConnectNotAllowedError:
        Real HTTP connections are disabled. Unregistered request: HEAD http://elastic:changeme@elasticsearch:9200/gitlab-test with headers {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip,deflate', 'Authorization'=>'Basic ZWxhc3RpYzpjaGFuZ2VtZQ==', 'Content-Type'=>'application/json', 'Date'=>'Fri, 21 Feb 2020 16:18:59 GMT', 'User-Agent'=>'Faraday v0.15.4'}
        You can stub this request with the following snippet:
        stub_request(:head, "http://elastic:changeme@elasticsearch:9200/gitlab-test").
          with(
            headers: {
        	  'Accept'=>'*/*',
        	  'Accept-Encoding'=>'gzip,deflate',
        	  'Authorization'=>'Basic ZWxhc3RpYzpjaGFuZ2VtZQ==',
        	  'Content-Type'=>'application/json',
        	  'Date'=>'Fri, 21 Feb 2020 16:18:59 GMT',
        	  'User-Agent'=>'Faraday v0.15.4'
            }).
          to_return(status: 200, body: "", headers: {})

Job #445999163 failed for f4a2c742:

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team

Closes #207531 (closed)

Edited by Dmitry Gruzd

Merge request reports