Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2024-01-05 00:07:37 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2024-01-05 00:07:37 +0300
commit808b8561f4e75b2db7c7e94a6c7651efb546048b (patch)
tree2cb7546939b56fef3a73a52dd8790de55f0fc0e4 /spec/finders
parentcc514c362bcd4b657bf6a6d1d37f5305952df363 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/finders')
-rw-r--r--spec/finders/deployments_finder_spec.rb4
-rw-r--r--spec/finders/members_finder_spec.rb6
-rw-r--r--spec/finders/releases/group_releases_finder_spec.rb6
-rw-r--r--spec/finders/resource_milestone_event_finder_spec.rb6
4 files changed, 11 insertions, 11 deletions
diff --git a/spec/finders/deployments_finder_spec.rb b/spec/finders/deployments_finder_spec.rb
index 807a7ca8e26..f45042d9c36 100644
--- a/spec/finders/deployments_finder_spec.rb
+++ b/spec/finders/deployments_finder_spec.rb
@@ -343,14 +343,14 @@ RSpec.describe DeploymentsFinder, feature_category: :deployment_management do
it 'avoids N+1 queries' do
execute_queries = -> { described_class.new({ group: group }).execute.first }
- control_count = ActiveRecord::QueryRecorder.new { execute_queries }.count
+ control = ActiveRecord::QueryRecorder.new { execute_queries }
new_project = create(:project, :repository, group: group)
new_env = create(:environment, project: new_project, name: "production")
create_list(:deployment, 2, status: :success, project: new_project, environment: new_env)
group.reload
- expect { execute_queries }.not_to exceed_query_limit(control_count)
+ expect { execute_queries }.not_to exceed_query_limit(control)
end
end
end
diff --git a/spec/finders/members_finder_spec.rb b/spec/finders/members_finder_spec.rb
index e0fc494d033..9c8b8658538 100644
--- a/spec/finders/members_finder_spec.rb
+++ b/spec/finders/members_finder_spec.rb
@@ -166,12 +166,12 @@ RSpec.describe MembersFinder, feature_category: :groups_and_projects do
# warm up
# We need this warm up because there is 1 query being fired in one of the policies,
- # and policy results are cached. Without a warm up, the control_count will be X queries
+ # and policy results are cached. Without a warm up, the control.count will be X queries
# but the test phase will only fire X-1 queries, due the fact that the
# result of the policy is already available in the cache.
described_class.new(project, user2).execute.map(&:user)
- control_count = ActiveRecord::QueryRecorder.new do
+ control = ActiveRecord::QueryRecorder.new do
described_class.new(project, user2).execute.map(&:user)
end
@@ -179,7 +179,7 @@ RSpec.describe MembersFinder, feature_category: :groups_and_projects do
expect do
described_class.new(project, user2).execute.map(&:user)
- end.to issue_same_number_of_queries_as(control_count)
+ end.to issue_same_number_of_queries_as(control)
end
context 'with :shared_into_ancestors' do
diff --git a/spec/finders/releases/group_releases_finder_spec.rb b/spec/finders/releases/group_releases_finder_spec.rb
index daefc94828b..3430fe834d1 100644
--- a/spec/finders/releases/group_releases_finder_spec.rb
+++ b/spec/finders/releases/group_releases_finder_spec.rb
@@ -168,9 +168,9 @@ RSpec.describe Releases::GroupReleasesFinder, feature_category: :groups_and_proj
let(:params) { query_params }
it 'subgroups avoids N+1 queries' do
- control_count = ActiveRecord::QueryRecorder.new(skip_cached: false) do
+ control = ActiveRecord::QueryRecorder.new(skip_cached: false) do
releases
- end.count
+ end
subgroups = create_list(:group, 10, parent: group)
projects = create_list(:project, 10, namespace: subgroups[0])
@@ -178,7 +178,7 @@ RSpec.describe Releases::GroupReleasesFinder, feature_category: :groups_and_proj
expect do
releases
- end.not_to exceed_all_query_limit(control_count)
+ end.not_to exceed_all_query_limit(control)
end
end
end
diff --git a/spec/finders/resource_milestone_event_finder_spec.rb b/spec/finders/resource_milestone_event_finder_spec.rb
index 27e124afe2e..a05059328e3 100644
--- a/spec/finders/resource_milestone_event_finder_spec.rb
+++ b/spec/finders/resource_milestone_event_finder_spec.rb
@@ -49,8 +49,8 @@ RSpec.describe ResourceMilestoneEventFinder do
milestone1 = create(:milestone, project: issue_project)
milestone2 = create(:milestone, project: issue_project)
- control_count = ActiveRecord::QueryRecorder.new { described_class.new(user, issue).execute }.count
- expect(control_count).to eq(1) # 1 events query
+ control = ActiveRecord::QueryRecorder.new { described_class.new(user, issue).execute }
+ expect(control.count).to eq(1) # 1 events query
create_event(milestone1, :add)
create_event(milestone1, :remove)
@@ -60,7 +60,7 @@ RSpec.describe ResourceMilestoneEventFinder do
create_event(milestone2, :remove)
# 1 milestones + 1 project + 1 user + 4 ability
- expect { described_class.new(user, issue).execute }.not_to exceed_query_limit(control_count + 6)
+ expect { described_class.new(user, issue).execute }.not_to exceed_query_limit(control).with_threshold(6)
end
end