Skip to content

Add Test::Integration::AiGateway Scenario

Valerie Burton requested to merge add-code-suggestions-integration-scenario into master

What does this MR do and why?

Relates to https://gitlab.com/gitlab-org/quality/quality-engineering/team-tasks/-/issues/2128

This MR adds a new AiGateway component and Test::Integration::AiGateway scenario in order to help test the code suggestions cloud licensing and authentication workflows for self-managed GitLab instances.

Related GitLab MR: gitlab!139717 (merged)

Test pipeline with specs: https://gitlab.com/gitlab-org/gitlab-qa/-/pipelines/1107551985

  • Please see the ai-gateway-sync-seat-link and ai-gateway-sync-service-token jobs for results

Next Steps 👉

Screenshots or screen recordings

N/A

How to set up and validate locally

  1. Check out this branch and add the following env vars:
export GITLAB_LICENSE_MODE=test
export QA_EE_ACTIVATION_CODE=<found in 1Password>

Optionally, you can also include QA_USE_SYNC_SERVICE_TOKEN_WORKER to also test the SyncServiceTokenWorker flow:

export QA_USE_SYNC_SERVICE_TOKEN_WORKER=true
  1. Run the following command locally to spin up the containers with no tests:
exe/gitlab-qa Test::Integration::AiGateway EE --no-tests
  1. Once the containers are up a running, login to the GitLab instance as the admin user and create a new personal access token.
  2. Send a cURL request to the code_suggestions/completions endpoint, such as the one below:
curl --location 'http://<gitlab_docker_url>/api/v4/code_suggestions/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <admin_token>' \
--data '
  {
    "prompt_version": 1,
    "current_file": {
      "file_name": "main.py",
      "content_above_cursor": "def reverse_string(s):\n    return s[::-1]\ndef test_empty_input_string()",
      "content_below_cursor": ""
    }
  }'
  1. Verify that the request is successful and that you receive a response

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 Valerie Burton

Merge request reports