summaryrefslogtreecommitdiff
path: root/spec/lib
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/lib
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/lib')
-rw-r--r--spec/lib/gitlab/graphql_logger_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/lib/gitlab/graphql_logger_spec.rb b/spec/lib/gitlab/graphql_logger_spec.rb
new file mode 100644
index 00000000000..51c77181927
--- /dev/null
+++ b/spec/lib/gitlab/graphql_logger_spec.rb
@@ -0,0 +1,21 @@
+require 'spec_helper'
+
+describe Gitlab::GraphqlLogger, :request_store do
+ subject { described_class.new('/dev/null') }
+ let(:now) { Time.now }
+
+ it 'builds a logger once' do
+ expect(::Logger).to receive(:new).and_call_original
+
+ subject.info('hello world')
+ subject.error('hello again')
+ end
+
+ describe '#format_message' do
+ it 'formats properly' do
+ output = subject.format_message('INFO', now, 'test', 'Hello world')
+
+ expect(output).to match(/Hello world/)
+ end
+ end
+end