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:
Diffstat (limited to 'spec/lib/gitlab/memory/diagnostic_reports_logger_spec.rb')
-rw-r--r--spec/lib/gitlab/memory/diagnostic_reports_logger_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/lib/gitlab/memory/diagnostic_reports_logger_spec.rb b/spec/lib/gitlab/memory/diagnostic_reports_logger_spec.rb
new file mode 100644
index 00000000000..6be528e34b6
--- /dev/null
+++ b/spec/lib/gitlab/memory/diagnostic_reports_logger_spec.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+require 'fast_spec_helper'
+
+RSpec.describe Gitlab::Memory::DiagnosticReportsLogger do
+ subject { described_class.new('/dev/null') }
+
+ let(:now) { Time.current }
+
+ describe '#format_message' do
+ it 'formats incoming hash properly' do
+ output = subject.format_message('INFO', now, 'test', { hello: 1 })
+ # Disabling the cop because it is not relevant, we encode with `JSON.generate`. Allows `fast_spec_helper`.
+ data = JSON.parse(output) # rubocop: disable Gitlab/Json
+
+ expect(data['severity']).to eq('INFO')
+ expect(data['time']).to eq(now.utc.iso8601(3))
+ expect(data['hello']).to eq(1)
+ expect(data['message']).to be_nil
+ end
+ end
+end