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>2021-05-14 15:10:58 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-14 15:10:58 +0300
commit793d974d7c4bd8c9cbd437a9e35087092f4e8bea (patch)
treea88b391ab97bc58f1d1eb665eec7cf64ce072716 /spec/graphql
parentc19bb4adbf354562715ba019892f464080eba850 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/graphql')
-rw-r--r--spec/graphql/resolvers/design_management/versions_resolver_spec.rb14
-rw-r--r--spec/graphql/types/ci/pipeline_type_spec.rb2
-rw-r--r--spec/graphql/types/design_management/version_type_spec.rb2
3 files changed, 16 insertions, 2 deletions
diff --git a/spec/graphql/resolvers/design_management/versions_resolver_spec.rb b/spec/graphql/resolvers/design_management/versions_resolver_spec.rb
index 23d4d86c79a..2c9c3a47650 100644
--- a/spec/graphql/resolvers/design_management/versions_resolver_spec.rb
+++ b/spec/graphql/resolvers/design_management/versions_resolver_spec.rb
@@ -41,6 +41,20 @@ RSpec.describe Resolvers::DesignManagement::VersionsResolver do
it 'returns the ordered versions' do
expect(result.to_a).to eq(all_versions)
end
+
+ context 'loading associations' do
+ it 'prevents N+1 queries when loading author' do
+ control_count = ActiveRecord::QueryRecorder.new(skip_cached: false) do
+ resolve_versions(object).items.map(&:author)
+ end.count
+
+ create_list(:design_version, 3, issue: issue)
+
+ expect do
+ resolve_versions(object).items.map(&:author)
+ end.not_to exceed_all_query_limit(control_count)
+ end
+ end
end
context 'when constrained' do
diff --git a/spec/graphql/types/ci/pipeline_type_spec.rb b/spec/graphql/types/ci/pipeline_type_spec.rb
index c67e86a7ee1..35d48229fa4 100644
--- a/spec/graphql/types/ci/pipeline_type_spec.rb
+++ b/spec/graphql/types/ci/pipeline_type_spec.rb
@@ -9,7 +9,7 @@ RSpec.describe Types::Ci::PipelineType do
it 'contains attributes related to a pipeline' do
expected_fields = %w[
- id iid sha before_sha status detailed_status config_source
+ id iid sha before_sha complete status detailed_status config_source
duration queued_duration
coverage created_at updated_at started_at finished_at committed_at
stages user retryable cancelable jobs source_job job downstream
diff --git a/spec/graphql/types/design_management/version_type_spec.rb b/spec/graphql/types/design_management/version_type_spec.rb
index 017cc1775a1..62335a65fdf 100644
--- a/spec/graphql/types/design_management/version_type_spec.rb
+++ b/spec/graphql/types/design_management/version_type_spec.rb
@@ -6,7 +6,7 @@ RSpec.describe GitlabSchema.types['DesignVersion'] do
it { expect(described_class).to require_graphql_authorizations(:read_design) }
it 'has the expected fields' do
- expected_fields = %i[id sha designs design_at_version designs_at_version]
+ expected_fields = %i[id sha designs design_at_version designs_at_version author created_at]
expect(described_class).to have_graphql_fields(*expected_fields)
end