diff options
Diffstat (limited to 'spec/features/dashboard/projects_spec.rb')
-rw-r--r-- | spec/features/dashboard/projects_spec.rb | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/spec/features/dashboard/projects_spec.rb b/spec/features/dashboard/projects_spec.rb index 779fbb48ddb..bb48a9ab95c 100644 --- a/spec/features/dashboard/projects_spec.rb +++ b/spec/features/dashboard/projects_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' RSpec.describe 'Dashboard Projects', feature_category: :projects do let_it_be(:user) { create(:user) } - let_it_be(:project, reload: true) { create(:project, :repository) } + let_it_be(:project, reload: true) { create(:project, :repository, creator: build(:user)) } # ensure creator != owner to avoid N+1 false-positive let_it_be(:project2) { create(:project, :public) } before do @@ -239,7 +239,7 @@ RSpec.describe 'Dashboard Projects', feature_category: :projects do create(:ci_pipeline, :with_job, status: :success, project: project, ref: project.default_branch, sha: project.commit.sha) visit dashboard_projects_path - control_count = ActiveRecord::QueryRecorder.new { visit dashboard_projects_path }.count + control = ActiveRecord::QueryRecorder.new { visit dashboard_projects_path } new_project = create(:project, :repository, name: 'new project') create(:ci_pipeline, :with_job, status: :success, project: new_project, ref: new_project.commit.sha) @@ -247,15 +247,12 @@ RSpec.describe 'Dashboard Projects', feature_category: :projects do ActiveRecord::QueryRecorder.new { visit dashboard_projects_path }.count - # There are seven known N+1 queries: https://gitlab.com/gitlab-org/gitlab/-/issues/214037 - # 1. Project#open_issues_count - # 2. Project#open_merge_requests_count - # 3. Project#forks_count - # 4. ProjectsHelper#load_pipeline_status - # 5. RendersMemberAccess#preload_max_member_access_for_collection - # 6. User#max_member_access_for_project_ids - # 7. Ci::CommitWithPipeline#last_pipeline + # There are a few known N+1 queries: https://gitlab.com/gitlab-org/gitlab/-/issues/214037 + # - Project#open_merge_requests_count + # - User#max_member_access_for_project_ids + # - ProjectsHelper#load_pipeline_status / Ci::CommitWithPipeline#last_pipeline + # - Ci::Pipeline#detailed_status - expect { visit dashboard_projects_path }.not_to exceed_query_limit(control_count + 7) + expect { visit dashboard_projects_path }.not_to exceed_query_limit(control).with_threshold(0) end end |