diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-11 03:09:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-11 03:09:09 +0300 |
commit | 47ebeef9122af96dc1fcd5c8e1ca0091f62fa113 (patch) | |
tree | f140bf150d6670b734e981851070e73c270fc45f /spec/lib/gitlab/graphql | |
parent | 06bb4eba7828ce59fde366734828458c037059b4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/graphql')
-rw-r--r-- | spec/lib/gitlab/graphql/timeout_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/lib/gitlab/graphql/timeout_spec.rb b/spec/lib/gitlab/graphql/timeout_spec.rb new file mode 100644 index 00000000000..8e04586d0ec --- /dev/null +++ b/spec/lib/gitlab/graphql/timeout_spec.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Gitlab::Graphql::Timeout do + it 'inherits from ' do + expect(described_class.superclass).to eq GraphQL::Schema::Timeout + end + + it 'sends the error to our GraphQL logger' do + parent_type = double(graphql_name: 'parent_type') + field = double(graphql_name: 'field') + query = double(query_string: 'query_string', provided_variables: 'provided_variables') + error = GraphQL::Schema::Timeout::TimeoutError.new(parent_type, field) + + expect(Gitlab::GraphqlLogger) + .to receive(:error) + .with(message: 'Timeout on parent_type.field', query: 'query_string', query_variables: 'provided_variables') + + timeout = described_class.new(max_seconds: 30) + timeout.handle_timeout(error, query) + end +end |