Fix WebMock::NetConnectNotAllowedError spec failure
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
- [-] Changelog entry
- [-] Documentation (if required)
-
Code review guidelines - [-] Merge request performance guidelines
-
Style guides - [-] Database guides
- [-] Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
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