summaryrefslogtreecommitdiff
path: root/spec/requests/api
diff options
context:
space:
mode:
authorcharlieablett <cablett@gitlab.com>2019-05-02 12:16:49 +1200
committercharlieablett <cablett@gitlab.com>2019-05-30 18:27:28 +1200
commit2c011cb5b452409db7fe1c810f1ad7440a6cedce (patch)
treef2b85b2ae667dd2673090efa0d984da328d0e031 /spec/requests/api
parent1f37aed1c917260eefda63a18d3a9af91c4a1abb (diff)
downloadgitlab-ce-2c011cb5b452409db7fe1c810f1ad7440a6cedce.tar.gz
Implement logger analyzer
- Modify GraphqlLogger to subclass JsonLogger - Replace the single-line analyser with one that can log all the GraphQL query related information in one place. - Implement analyzer behavior with spec
Diffstat (limited to 'spec/requests/api')
-rw-r--r--spec/requests/api/graphql_spec.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/requests/api/graphql_spec.rb b/spec/requests/api/graphql_spec.rb
index cca87c16f27..103b02ba7a7 100644
--- a/spec/requests/api/graphql_spec.rb
+++ b/spec/requests/api/graphql_spec.rb
@@ -16,6 +16,17 @@ describe 'GraphQL' do
end
end
+ context 'logging' do
+ it 'logs the query' do
+ expected = { query_string: query, variables: {}, duration: anything }
+
+ expect(Gitlab::GraphqlLogger).to receive(:info).with(expected)
+
+ post_graphql(query)
+ end
+
+ end
+
context 'invalid variables' do
it 'returns an error' do
post_graphql(query, variables: "This is not JSON")