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-24 06:09:32 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2024-01-24 06:09:32 +0300
commit3f29b140ab13fd23ed35e759fd2bb6f41ba788ac (patch)
tree14038bc12e68f9d39d0893db406d8b4fcbe78dd0 /spec/support/shared_examples/bulk_imports/graphql_query_shared_examples.rb
parent3b0fd281ca3a8b1d88f3bbfc00a4d3e56a1c3870 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_examples/bulk_imports/graphql_query_shared_examples.rb')
-rw-r--r--spec/support/shared_examples/bulk_imports/graphql_query_shared_examples.rb43
1 files changed, 43 insertions, 0 deletions
diff --git a/spec/support/shared_examples/bulk_imports/graphql_query_shared_examples.rb b/spec/support/shared_examples/bulk_imports/graphql_query_shared_examples.rb
new file mode 100644
index 00000000000..e32a0669ac5
--- /dev/null
+++ b/spec/support/shared_examples/bulk_imports/graphql_query_shared_examples.rb
@@ -0,0 +1,43 @@
+# frozen_string_literal: true
+
+RSpec.shared_examples 'a valid Direct Transfer GraphQL query' do
+ let(:graphql_log) do
+ GitlabSchema.execute(
+ query.to_s,
+ variables: query.variables
+ )
+
+ RequestStore.store[:graphql_logs].first
+ end
+
+ it 'has a valid query' do
+ parsed_query = GraphQL::Query.new(
+ GitlabSchema,
+ query.to_s,
+ variables: query.variables
+ )
+
+ result = GitlabSchema.static_validator.validate(parsed_query)
+
+ expect(result[:errors]).to be_empty
+ end
+
+ it 'does not use any deprecated GraphQL schema' do
+ expect(graphql_log.keys).to include(
+ :used_deprecated_fields,
+ :used_deprecated_arguments
+ )
+ expect(graphql_log[:used_deprecated_fields]).to be_empty
+ expect(graphql_log[:used_deprecated_arguments]).to be_empty
+ end
+
+ it 'does not exceed max authenticated complexity' do
+ expect(graphql_log).to have_key(:complexity)
+ expect(graphql_log[:complexity]).to be < GitlabSchema::AUTHENTICATED_MAX_COMPLEXITY
+ end
+
+ it 'does not exceed max depth' do
+ expect(graphql_log).to have_key(:depth)
+ expect(graphql_log[:depth]).to be < GitlabSchema::DEFAULT_MAX_DEPTH
+ end
+end