summaryrefslogtreecommitdiff
path: root/spec/requests/api
diff options
context:
space:
mode:
authorcharlieablett <cablett@gitlab.com>2019-04-30 20:30:15 +1200
committercharlieablett <cablett@gitlab.com>2019-05-30 18:27:28 +1200
commit1f37aed1c917260eefda63a18d3a9af91c4a1abb (patch)
treea6912284b0984fb50a487a2e23ce6fbc0c3905d6 /spec/requests/api
parente33cab9f20971aa1b8076a4fef42e5022abe115f (diff)
downloadgitlab-ce-1f37aed1c917260eefda63a18d3a9af91c4a1abb.tar.gz
New logfile for graphql queries
Specify dedicated logfile and logger class for GraphQL queries. Move complexity analyzer to a dedicated class.
Diffstat (limited to 'spec/requests/api')
-rw-r--r--spec/requests/api/graphql/gitlab_schema_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/requests/api/graphql/gitlab_schema_spec.rb b/spec/requests/api/graphql/gitlab_schema_spec.rb
index a724c5c3f1c..0eb026f1ed9 100644
--- a/spec/requests/api/graphql/gitlab_schema_spec.rb
+++ b/spec/requests/api/graphql/gitlab_schema_spec.rb
@@ -83,6 +83,16 @@ describe 'GitlabSchema configurations' do
end
end
+ context 'logging' do
+ it 'writes to the GraphQL log' do
+ expect(Gitlab::GraphqlLogger).to receive(:info).with(/Query Complexity/)
+
+ query = File.read(Rails.root.join('spec/fixtures/api/graphql/introspection.graphql'))
+
+ post_graphql(query, current_user: nil)
+ end
+ end
+
context 'when IntrospectionQuery' do
it 'is not too complex' do
query = File.read(Rails.root.join('spec/fixtures/api/graphql/introspection.graphql'))