diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-05-24 16:55:24 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-05-24 16:55:24 +0200 |
commit | f0d7445b88f6598db85198296c076bf59508188a (patch) | |
tree | 6da862151641d3eb90ad2256f5db45e68f8ace7d /spec/serializers | |
parent | bc9a0e10b50430e0b253a15d1628b6776d0bd9fe (diff) | |
download | gitlab-ce-f0d7445b88f6598db85198296c076bf59508188a.tar.gz |
Reduce pipeline serialization queries when preloaded
Diffstat (limited to 'spec/serializers')
-rw-r--r-- | spec/serializers/pipeline_serializer_spec.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/spec/serializers/pipeline_serializer_spec.rb b/spec/serializers/pipeline_serializer_spec.rb index 5108eb4deec..9319d29279a 100644 --- a/spec/serializers/pipeline_serializer_spec.rb +++ b/spec/serializers/pipeline_serializer_spec.rb @@ -99,7 +99,8 @@ describe PipelineSerializer do end end - context 'number of queries' do + describe 'number of queries when preloaded' do + subject { serializer.represent(resource, preload: true) } let(:resource) { Ci::Pipeline.all } before do @@ -120,7 +121,7 @@ describe PipelineSerializer do it 'verifies number of queries', :request_store do recorded = ActiveRecord::QueryRecorder.new { subject } - expect(recorded.count).to be_within(1).of(38) + expect(recorded.count).to be_within(1).of(31) expect(recorded.cached_count).to eq(0) end end @@ -139,7 +140,7 @@ describe PipelineSerializer do # pipeline. With the same ref this check is cached but if refs are # different then there is an extra query per ref # https://gitlab.com/gitlab-org/gitlab-ce/issues/46368 - expect(recorded.count).to be_within(1).of(45) + expect(recorded.count).to be_within(1).of(38) expect(recorded.cached_count).to eq(0) end end |