summaryrefslogtreecommitdiff
path: root/spec/requests
diff options
context:
space:
mode:
authorcharlieablett <cablett@gitlab.com>2019-05-22 17:13:06 +1200
committercharlieablett <cablett@gitlab.com>2019-05-30 18:27:28 +1200
commit184a5120dc764d33cece108fbc85b0ec96f7c050 (patch)
treebdf00d369d555a629d7f83d26fe8d0c719de449d /spec/requests
parentb94a17e00efc89187aefd24d388e36584cd11784 (diff)
downloadgitlab-ce-184a5120dc764d33cece108fbc85b0ec96f7c050.tar.gz
Call analyzers from LoggerAnalyzer
- Add changelog file - Fix failing tests
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/api/graphql/gitlab_schema_spec.rb16
-rw-r--r--spec/requests/api/graphql_spec.rb6
2 files changed, 15 insertions, 7 deletions
diff --git a/spec/requests/api/graphql/gitlab_schema_spec.rb b/spec/requests/api/graphql/gitlab_schema_spec.rb
index dcce8c1dbad..510dec5edb2 100644
--- a/spec/requests/api/graphql/gitlab_schema_spec.rb
+++ b/spec/requests/api/graphql/gitlab_schema_spec.rb
@@ -84,10 +84,18 @@ describe 'GitlabSchema configurations' do
end
context 'logging' do
- it 'writes to the GraphQL log' do
- expect(Gitlab::GraphqlLogger).to receive(:info)
-
- query = File.read(Rails.root.join('spec/fixtures/api/graphql/introspection.graphql'))
+ let(:query) { File.read(Rails.root.join('spec/fixtures/api/graphql/introspection.graphql')) }
+
+ it 'logs the query complexity' do
+ analyzer_memo = {
+ query_string: query,
+ variables: {},
+ complexity: 181,
+ depth: 0,
+ duration: "7ms"
+ }
+ expect_any_instance_of(Gitlab::Graphql::QueryAnalyzers::LoggerAnalyzer).to receive(:duration).and_return(7)
+ expect(Gitlab::GraphqlLogger).to receive(:info).with(analyzer_memo)
post_graphql(query, current_user: nil)
end
diff --git a/spec/requests/api/graphql_spec.rb b/spec/requests/api/graphql_spec.rb
index 036dfa41952..ebf223127b5 100644
--- a/spec/requests/api/graphql_spec.rb
+++ b/spec/requests/api/graphql_spec.rb
@@ -23,7 +23,7 @@ describe 'GraphQL' do
context 'with no variables' do
let(:expected) do
- { query_string: query, variables: {}, duration: anything, depth: 0, complexity: 0 }
+ { query_string: query, variables: {}, duration: anything, depth: 1, complexity: 1 }
end
it 'logs the query' do
@@ -33,10 +33,10 @@ describe 'GraphQL' do
context 'with variables' do
let!(:variables) do
- { foo: "bar" }
+ { "foo" => "bar" }
end
let(:expected) do
- { query_string: query, variables: variables, duration: anything, depth: 0, complexity: 0 }
+ { query_string: query, variables: variables, duration: anything, depth: 1, complexity: 1 }
end
it 'logs the query' do