Commit c707c915 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'mo-remove-tests-total-count-pipeline-entity' into 'master'

Remove tests_total_count from PipelineEntity

See merge request gitlab-org/gitlab!40984
parents 1949b6bb accb9488
......@@ -880,7 +880,9 @@ module Ci
end
def test_report_summary
Gitlab::Ci::Reports::TestReportSummary.new(latest_builds_report_results)
strong_memoize(:test_report_summary) do
Gitlab::Ci::Reports::TestReportSummary.new(latest_builds_report_results)
end
end
def test_reports
......
......@@ -85,10 +85,6 @@ class PipelineEntity < Grape::Entity
pipeline.failed_builds
end
expose :tests_total_count do |pipeline|
pipeline.test_report_summary.total[:count]
end
private
alias_method :pipeline, :object
......
......@@ -43,7 +43,7 @@ RSpec.describe Projects::PipelinesController do
end
end
it 'executes N+1 queries' do
it 'does not execute N+1 queries' do
get_pipelines_index_json
control_count = ActiveRecord::QueryRecorder.new do
......@@ -53,7 +53,7 @@ RSpec.describe Projects::PipelinesController do
create_all_pipeline_types
# There appears to be one extra query for Pipelines#has_warnings? for some reason
expect { get_pipelines_index_json }.not_to exceed_query_limit(control_count + 7)
expect { get_pipelines_index_json }.not_to exceed_query_limit(control_count + 1)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['pipelines'].count).to eq 12
end
......
......@@ -260,13 +260,5 @@ RSpec.describe PipelineEntity do
end
end
end
context 'when pipeline has build report results' do
let(:pipeline) { create(:ci_pipeline, :with_report_results, project: project, user: user) }
it 'exposes tests total count' do
expect(subject[:tests_total_count]).to eq(2)
end
end
end
end
......@@ -155,7 +155,7 @@ RSpec.describe PipelineSerializer do
it 'verifies number of queries', :request_store do
recorded = ActiveRecord::QueryRecorder.new { subject }
expected_queries = Gitlab.ee? ? 46 : 43
expected_queries = Gitlab.ee? ? 43 : 40
expect(recorded.count).to be_within(2).of(expected_queries)
expect(recorded.cached_count).to eq(0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment