diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-07 00:10:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-07 00:10:28 +0300 |
commit | a303eb5d329ee4fee3ad76b9c2e32ce1d6d4a13b (patch) | |
tree | d586f0a605912b6b4b519afca03b20e0ca0e9e65 /spec/requests | |
parent | 2644e59eb5a3a976d445a08727f41428647fdbec (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/projects/ml/models_controller_spec.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/spec/requests/projects/ml/models_controller_spec.rb b/spec/requests/projects/ml/models_controller_spec.rb index 028fde06486..cda3f777a72 100644 --- a/spec/requests/projects/ml/models_controller_spec.rb +++ b/spec/requests/projects/ml/models_controller_spec.rb @@ -43,17 +43,26 @@ RSpec.describe Projects::Ml::ModelsController, feature_category: :mlops do index_request end - it 'fetches the correct models' do + it 'fetches the correct variables', :aggregate_failures do + stub_const("Projects::Ml::ModelsController::MAX_MODELS_PER_PAGE", 2) + index_request - expect(assigns(:paginator).records).to match_array([model3, model2, model1]) + page_models = [model3, model2] + all_models = [model3, model2, model1] + + expect(assigns(:paginator).records).to match_array(page_models) + expect(assigns(:model_count)).to be all_models.count end it 'does not perform N+1 sql queries' do + list_models + control_count = ActiveRecord::QueryRecorder.new(skip_cached: false) { list_models } create_list(:ml_model_versions, 2, model: model1) create_list(:ml_model_versions, 2, model: model2) + create_list(:ml_models, 4, project: project) expect { list_models }.not_to exceed_all_query_limit(control_count) end |