diff options
author | charlieablett <cablett@gitlab.com> | 2019-05-24 00:29:19 +0300 |
---|---|---|
committer | charlieablett <cablett@gitlab.com> | 2019-05-30 09:27:42 +0300 |
commit | 5f0c230a18b677bd4ec6a4a54085775b0c69a498 (patch) | |
tree | 6dcd917429f27497669406429ee8192507fcb39b /spec/lib/gitlab/graphql_logger_spec.rb | |
parent | d0e32c2cd33476c5ee7f835d14b97068adeb805d (diff) |
Move complexity/depth to `final_value`
Tidy tests according to reviewer comments.
Move complexity and depth calls from `initial_value` to `final_value`
Log variables as json
Diffstat (limited to 'spec/lib/gitlab/graphql_logger_spec.rb')
-rw-r--r-- | spec/lib/gitlab/graphql_logger_spec.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/spec/lib/gitlab/graphql_logger_spec.rb b/spec/lib/gitlab/graphql_logger_spec.rb index 4157bb86f1c..c8d4dac2153 100644 --- a/spec/lib/gitlab/graphql_logger_spec.rb +++ b/spec/lib/gitlab/graphql_logger_spec.rb @@ -4,6 +4,7 @@ require 'spec_helper' describe Gitlab::GraphqlLogger do subject { described_class.new('/dev/null') } + let(:now) { Time.now } it 'builds a logger once' do @@ -15,13 +16,14 @@ describe Gitlab::GraphqlLogger do context 'logging a GraphQL query' do let(:query) { File.read(Rails.root.join('spec/fixtures/api/graphql/introspection.graphql')) } + it 'logs a query from JSON' do analyzer_memo = { query_string: query, variables: {}, complexity: 181, depth: 0, - duration: "7ms" + duration: 7 } output = subject.format_message('INFO', now, 'test', analyzer_memo) data = JSON.parse(output) @@ -31,7 +33,7 @@ describe Gitlab::GraphqlLogger do expect(data['complexity']).to eq(181) expect(data['variables']).to eq({}) expect(data['depth']).to eq(0) - expect(data['duration']).to eq("7ms") + expect(data['duration']).to eq(7) end end end |