Add Test::Integration::AiGateway Scenario
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
andai-gateway-sync-service-token
jobs for results
Next Steps
- Open an MR for GitLab to update the following (done: gitlab!139717 (merged))
- Update qa/specs/features/ee/api/14_model_ops/code_suggestions_spec.rb to run against this orchestrated scenario
- Add a new
AiGateway
scenario class toqa/ee/scenario/test/integration
- Update
main.gitlab-ci.yml
to include two new jobs that will run this scenario with and without theQA_USE_SYNC_SERVICE_TOKEN_WORKER
environment variable. This will allow us to run tests against both theSyncServiceTokenWorker
andSyncSeatLinkWorker
workflows when generating a code suggestions access token, which is currently controlled by the feature flag <code data-sourcepos="22:473-22:501">use_sync_service_token_worker</code>.
- After that, work on the next iteration of updating qa/specs/features/ee/browser_ui/3_create/web_ide/code_suggestions_in_web_ide_spec.rb to also run in this orchestrated scenario
Screenshots or screen recordings
N/A
How to set up and validate locally
- 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
- Run the following command locally to spin up the containers with no tests:
exe/gitlab-qa Test::Integration::AiGateway EE --no-tests
- Once the containers are up a running, login to the GitLab instance as the admin user and create a new personal access token.
- 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": ""
}
}'
- 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.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Valerie Burton