Skip to content

Write the specs properly

Ravi Kumar requested to merge fix-some-tests into master

What does this MR do and why?

I have noticed some specs were not written properly.

  • ee/spec/lib/elastic/latest/git_class_proxy_spec.rb: Send one more project_id in the options[:project_ids] to test the multiple routing feature. I found that it was not working so I had to change the stubbing strategy in the file ee/spec/support/helpers/elasticsearch_helpers.rb

  • ee/spec/lib/gitlab/elastic/search_results_spec.rb: project_id will always be present in the _source so added this field also in the _source for the test. To give the context why I fixed this because in the case of GroupWiki project_id will be missing and that's how I will differentiate the Group level search from the project-level search

  • ee/spec/services/search/group_service_spec.rb: It is a group search, so project should be under a group. We were setting group as project.namespace but again the issue is project.namespace is a UserNamespace. Similar case as the first one.

  • ee/spec/support/helpers/elasticsearch_helpers.rb: When there is multiple routing like routing=project_1,project_2, the comma(,) was getting encoded in %2C and the stubbing was not working, so I have used the regex to create URI.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Ravi Kumar

Merge request reports

Loading