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-04-30 11:30:15 +0300
committercharlieablett <cablett@gitlab.com>2019-05-30 09:27:28 +0300
commit1f37aed1c917260eefda63a18d3a9af91c4a1abb (patch)
treea6912284b0984fb50a487a2e23ce6fbc0c3905d6 /spec/lib/gitlab/graphql_logger_spec.rb
parente33cab9f20971aa1b8076a4fef42e5022abe115f (diff)
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/gitlab/graphql_logger_spec.rb')
-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