diff --git a/app/graphql/gitlab_schema.rb b/app/graphql/gitlab_schema.rb index 63427141fad09832a5be3031fb36551794847b5a..2c4cbb45f97207f8fe47a44d333747e24d4fff20 100644 --- a/app/graphql/gitlab_schema.rb +++ b/app/graphql/gitlab_schema.rb @@ -32,7 +32,7 @@ class GitlabSchema < GraphQL::Schema default_max_page_size 100 validate_max_errors 5 - validate_timeout 0.5.seconds + validate_timeout 0.2.seconds lazy_resolve ::Gitlab::Graphql::Lazy, :force diff --git a/spec/graphql/gitlab_schema_spec.rb b/spec/graphql/gitlab_schema_spec.rb index 0f46b226f2ec0f28a73a86463c929fd4e3303ddb..c9ae3dc987ed764abe975fc5525f95b73a11b318 100644 --- a/spec/graphql/gitlab_schema_spec.rb +++ b/spec/graphql/gitlab_schema_spec.rb @@ -33,7 +33,7 @@ end it 'sets an appropriate validation timeout' do - expect(described_class.validate_timeout).to be <= 0.5.seconds + expect(described_class.validate_timeout).to be <= 0.2.seconds end describe '.execute' do diff --git a/spec/support/helpers/graphql_helpers.rb b/spec/support/helpers/graphql_helpers.rb index 085340d6cb96cc2c4beebd497058adb33bcea8c2..b93103d6b7b21f8972f287f2388432cf2625620c 100644 --- a/spec/support/helpers/graphql_helpers.rb +++ b/spec/support/helpers/graphql_helpers.rb @@ -461,6 +461,7 @@ def all_graphql_fields_for(class_name, max_depth: 3, excluded: []) allow_unlimited_graphql_complexity allow_unlimited_graphql_depth if max_depth > 1 + allow_unlimited_validation_timeout allow_high_graphql_recursion allow_high_graphql_transaction_threshold allow_high_graphql_query_size @@ -727,6 +728,11 @@ def allow_unlimited_graphql_depth allow(GitlabSchema).to receive(:max_query_depth).with(any_args).and_return nil end + def allow_unlimited_validation_timeout + allow_any_instance_of(GitlabSchema).to receive(:validate_timeout).and_return nil + allow(GitlabSchema).to receive(:validate_timeout).with(any_args).and_return nil + end + def allow_high_graphql_recursion allow_any_instance_of(Gitlab::Graphql::QueryAnalyzers::AST::RecursionAnalyzer).to receive(:recursion_threshold).and_return 1000 end