diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 10:00:54 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 10:00:54 +0000 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /spec/support/shared_examples/serializers | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) | |
download | gitlab-ce-3cccd102ba543e02725d247893729e5c73b38295.tar.gz |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'spec/support/shared_examples/serializers')
-rw-r--r-- | spec/support/shared_examples/serializers/environment_serializer_shared_examples.rb | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/spec/support/shared_examples/serializers/environment_serializer_shared_examples.rb b/spec/support/shared_examples/serializers/environment_serializer_shared_examples.rb index 87a33060435..fcd52cdf7fa 100644 --- a/spec/support/shared_examples/serializers/environment_serializer_shared_examples.rb +++ b/spec/support/shared_examples/serializers/environment_serializer_shared_examples.rb @@ -1,8 +1,5 @@ # frozen_string_literal: true RSpec.shared_examples 'avoid N+1 on environments serialization' do |ee: false| - # Investigating in https://gitlab.com/gitlab-org/gitlab/-/issues/353209 - let(:query_threshold) { 1 + (ee ? 4 : 0) } - it 'avoids N+1 database queries with grouping', :request_store do create_environment_with_associations(project) @@ -11,9 +8,11 @@ RSpec.shared_examples 'avoid N+1 on environments serialization' do |ee: false| create_environment_with_associations(project) create_environment_with_associations(project) - expect { serialize(grouping: true) } - .not_to exceed_query_limit(control.count) - .with_threshold(query_threshold) + # Fix N+1 queries introduced by multi stop_actions for environment. + # Tracked in https://gitlab.com/gitlab-org/gitlab/-/issues/358780 + relax_count = 14 + + expect { serialize(grouping: true) }.not_to exceed_query_limit(control.count + relax_count) end it 'avoids N+1 database queries without grouping', :request_store do @@ -24,9 +23,11 @@ RSpec.shared_examples 'avoid N+1 on environments serialization' do |ee: false| create_environment_with_associations(project) create_environment_with_associations(project) - expect { serialize(grouping: false) } - .not_to exceed_query_limit(control.count) - .with_threshold(query_threshold) + # Fix N+1 queries introduced by multi stop_actions for environment. + # Tracked in https://gitlab.com/gitlab-org/gitlab/-/issues/358780 + relax_count = 14 + + expect { serialize(grouping: false) }.not_to exceed_query_limit(control.count + relax_count) end it 'does not preload for environments that does not exist in the page', :request_store do |