Skip to content

E2E tests: relax CS assertion for v3

Jay McCure requested to merge jmc-relax-cs-assert into master

What does this MR do and why?

Resolves https://gitlab.com/gitlab-org/gitlab/-/issues/498373

Handles response for v3 of code suggestions endpoint, so we can enable #477891 (closed)

/v3/code/completions changes the response structure in the following way (no id, new metadata object for example):

--- a/qa/qa/specs/features/ee/api/3_create/code_suggestions_spec.rb
+++ b/qa/qa/specs/features/ee/api/3_create/code_suggestions_spec.rb
@@ -10,15 +10,13 @@ module QA
     describe 'Code Suggestions' do
       let(:expected_response_data) do
         {
-          id: 'id',
+          metadata: {
           model: {
             engine: anything,
             name: anything,
-            lang: 'ruby',
-            tokens_consumption_metadata: anything
-          },
-          object: 'text_completion',
-          created: anything
+            lang: 'ruby'
+          }, timestamp: anything },
           choices: anything
         }
       end

To handle both V2 and V3 we will relax the assertion to check only for choices until the anthropic_code_gen_aigw_migration is completely rolled out.

Test passing in this MR: https://gitlab.com/gitlab-org/gitlab/-/jobs/8057513605

Test passing in staging with anthropic_code_gen_aigw_migration FF turned on: https://ops.gitlab.net/gitlab-org/quality/staging/-/jobs/15658225

Test passing in staging without anthropic_code_gen_aigw_migration FF turned on: https://ops.gitlab.net/gitlab-org/quality/staging/-/jobs/15657322

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Jay McCure

Merge request reports

Loading