summaryrefslogtreecommitdiff
path: root/spec/serializers/pipeline_serializer_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/serializers/pipeline_serializer_spec.rb')
-rw-r--r--spec/serializers/pipeline_serializer_spec.rb21
1 files changed, 20 insertions, 1 deletions
diff --git a/spec/serializers/pipeline_serializer_spec.rb b/spec/serializers/pipeline_serializer_spec.rb
index bcaaa61eb04..6028da301f3 100644
--- a/spec/serializers/pipeline_serializer_spec.rb
+++ b/spec/serializers/pipeline_serializer_spec.rb
@@ -202,13 +202,32 @@ RSpec.describe PipelineSerializer do
# Existing numbers are high and require performance optimization
# Ongoing issue:
# https://gitlab.com/gitlab-org/gitlab/-/issues/225156
- expected_queries = Gitlab.ee? ? 85 : 76
+ expected_queries = Gitlab.ee? ? 82 : 76
expect(recorded.count).to be_within(2).of(expected_queries)
expect(recorded.cached_count).to eq(0)
end
end
+ context 'with build environments' do
+ let(:ref) { 'feature' }
+
+ it 'verifies number of queries', :request_store do
+ stub_licensed_features(protected_environments: true)
+
+ env = create(:environment, project: project)
+ create(:ci_build, :scheduled, project: project, environment: env.name)
+ create(:ci_build, :scheduled, project: project, environment: env.name)
+ create(:ci_build, :scheduled, project: project, environment: env.name)
+
+ recorded = ActiveRecord::QueryRecorder.new { subject }
+ expected_queries = Gitlab.ee? ? 61 : 57
+
+ expect(recorded.count).to be_within(1).of(expected_queries)
+ expect(recorded.cached_count).to eq(0)
+ end
+ end
+
context 'with scheduled and manual builds' do
let(:ref) { 'feature' }