Skip to content

Resolve "Improve test coverage for Elasticsearch"

Hiru Fernando requested to merge 144-improve-test-coverage-for-elasticsearch into main

What does this MR do and why?

  • Connects to Elastic and verifies it can run a few different queries and get a non-error result.
    • Created generic code for building search query config and the search query itself and added it to helper file elastic_api_helpers.js.
    • Now these functions are shared between elastic_api.js, elastic_api_spec.js, and check_elastic_key_permissions.cjs files.
    • In the test we do run the production instance search.

Screenshots, screen recordings, or links to review app

With the added elastic_api tests, we can confirm that if the query is off, the tests do fail. I replaced the buildSearchQuery logic with logic from this reverted code.

image

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Configure a local GitLab Docs environment: https://gitlab.com/gitlab-org/technical-writing-group/gitlab-docs-hugo/-/blob/main/doc/setup.md.
  2. Make sure to run make jest-tests or watch pipeline for success, ensure check_elastic_key_permissions.cjs file still runs the checks correctly (I was able to verify with no changes to credentials and creating a key without permissions cases), and also make sure search is still working as expected in terms of filters, phrase searches, normal searches, etc.

Merge request acceptance checklist

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

Closes #144 (closed)

Edited by Hiru Fernando

Merge request reports

Loading