1
0
mirror of https://github.com/meineerde/rackstash.git synced 2025-12-19 15:01:12 +00:00

Ensure that the JSON encoder correctly serializes the event timestamp

This commit is contained in:
Holger Just 2018-01-27 00:32:37 +01:00
parent d6cc062b93
commit 952ecd5c73

View File

@ -32,5 +32,13 @@ describe Rackstash::Encoder::JSON do
event = { 'foo' => 'bar' } event = { 'foo' => 'bar' }
expect(encoder.encode(event)).to eql '{"foo":"bar"}' expect(encoder.encode(event)).to eql '{"foo":"bar"}'
end end
it 'normalizes the timestamp' do
time = Time.parse('2016-10-17 13:37:00 +03:00')
event = { 'message' => ["line1\n", "line2\n"], '@timestamp' => time }
expect(encoder.encode(event))
.to eql '{"message":"line1\nline2\n","@timestamp":"2016-10-17T10:37:00.000000Z"}'
end
end end
end end