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:
authorcharlieablett <cablett@gitlab.com>2019-05-22 08:13:06 +0300
committercharlieablett <cablett@gitlab.com>2019-05-30 09:27:28 +0300
commit184a5120dc764d33cece108fbc85b0ec96f7c050 (patch)
treebdf00d369d555a629d7f83d26fe8d0c719de449d /spec/lib/gitlab/graphql_logger_spec.rb
parentb94a17e00efc89187aefd24d388e36584cd11784 (diff)
Call analyzers from LoggerAnalyzer
- Add changelog file - Fix failing tests
Diffstat (limited to 'spec/lib/gitlab/graphql_logger_spec.rb')
-rw-r--r--spec/lib/gitlab/graphql_logger_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/lib/gitlab/graphql_logger_spec.rb b/spec/lib/gitlab/graphql_logger_spec.rb
index aeeed0b2ca1..4157bb86f1c 100644
--- a/spec/lib/gitlab/graphql_logger_spec.rb
+++ b/spec/lib/gitlab/graphql_logger_spec.rb
@@ -12,4 +12,26 @@ describe Gitlab::GraphqlLogger do
subject.info('hello world')
subject.error('hello again')
end
+
+ context 'logging a GraphQL query' do
+ let(:query) { File.read(Rails.root.join('spec/fixtures/api/graphql/introspection.graphql')) }
+ it 'logs a query from JSON' do
+ analyzer_memo = {
+ query_string: query,
+ variables: {},
+ complexity: 181,
+ depth: 0,
+ duration: "7ms"
+ }
+ output = subject.format_message('INFO', now, 'test', analyzer_memo)
+ data = JSON.parse(output)
+
+ expect(data['severity']).to eq('INFO')
+ expect(data['time']).to eq(now.utc.iso8601(3))
+ expect(data['complexity']).to eq(181)
+ expect(data['variables']).to eq({})
+ expect(data['depth']).to eq(0)
+ expect(data['duration']).to eq("7ms")
+ end
+ end
end