logstash-core-event 2.3.0.snapshot1-java → 2.3.0.snapshot3-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/logstash-core-event/version.rb +1 -1
- data/spec/logstash/timestamp_spec.rb +61 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c50470dd24fa4d3b9508c449babeceda32248a3
|
4
|
+
data.tar.gz: 44595e1c4dcb365c9b4659fd741326be69ac7fa2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d7c07a58cbbaac3a538edc150530ea6bc1d3cc983e73c05ebc174814fe21e412f4ada52479a5264f17ce706a1be90a26298209e193afddee32f4b83bff6b21b
|
7
|
+
data.tar.gz: 7098a60b7b35217bf7e7e43fcfde972a43e3157b21a284bba2d855fa0fd1d3cf7c1b6dcb8b399b95fca88dd416d0c49d4ae68ce30c6101c17b4172fad037f6d0
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require "spec_helper"
|
3
3
|
require "logstash/timestamp"
|
4
|
+
require "bigdecimal"
|
4
5
|
|
5
6
|
describe LogStash::Timestamp do
|
6
7
|
|
@@ -106,4 +107,64 @@ describe LogStash::Timestamp do
|
|
106
107
|
expect(subject.to_f).to eq(now.to_f)
|
107
108
|
end
|
108
109
|
end
|
110
|
+
|
111
|
+
context "at" do
|
112
|
+
context "with integer epoch" do
|
113
|
+
it "should convert to correct date" do
|
114
|
+
expect(LogStash::Timestamp.at(946702800).to_iso8601).to eq("2000-01-01T05:00:00.000Z")
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should return zero usec" do
|
118
|
+
expect(LogStash::Timestamp.at(946702800).usec).to eq(0)
|
119
|
+
end
|
120
|
+
|
121
|
+
it "should return prior to epoch date on negative input" do
|
122
|
+
expect(LogStash::Timestamp.at(-1).to_iso8601).to eq("1969-12-31T23:59:59.000Z")
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
context "with float epoch" do
|
127
|
+
it "should convert to correct date" do
|
128
|
+
expect(LogStash::Timestamp.at(946702800.123456.to_f).to_iso8601).to eq("2000-01-01T05:00:00.123Z")
|
129
|
+
end
|
130
|
+
|
131
|
+
it "should return usec with a minimum of millisec precision" do
|
132
|
+
expect(LogStash::Timestamp.at(946702800.123456.to_f).usec).to be_within(1000).of(123456)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
context "with BigDecimal epoch" do
|
137
|
+
it "should convert to correct date" do
|
138
|
+
expect(LogStash::Timestamp.at(BigDecimal.new("946702800.123456")).to_iso8601).to eq("2000-01-01T05:00:00.123Z")
|
139
|
+
end
|
140
|
+
|
141
|
+
it "should return usec with a minimum of millisec precision" do
|
142
|
+
# since Java Timestamp relies on JodaTime which supports only milliseconds precision
|
143
|
+
# the usec method will only be precise up to milliseconds.
|
144
|
+
expect(LogStash::Timestamp.at(BigDecimal.new("946702800.123456")).usec).to be_within(1000).of(123456)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
context "with illegal parameters" do
|
149
|
+
it "should raise exception on nil input" do
|
150
|
+
expect{LogStash::Timestamp.at(nil)}.to raise_error
|
151
|
+
end
|
152
|
+
|
153
|
+
it "should raise exception on invalid input type" do
|
154
|
+
expect{LogStash::Timestamp.at(:foo)}.to raise_error
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
context "usec" do
|
160
|
+
it "should support millisecond precision" do
|
161
|
+
expect(LogStash::Timestamp.at(946702800.123).usec).to eq(123000)
|
162
|
+
end
|
163
|
+
|
164
|
+
it "should try to preserve and report microseconds precision if possible" do
|
165
|
+
# since Java Timestamp relies on JodaTime which supports only milliseconds precision
|
166
|
+
# the usec method will only be precise up to milliseconds.
|
167
|
+
expect(LogStash::Timestamp.at(946702800.123456).usec).to be_within(1000).of(123456)
|
168
|
+
end
|
169
|
+
end
|
109
170
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-core-event
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.0.
|
4
|
+
version: 2.3.0.snapshot3
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: The core event component of logstash, the scalable log and event management tool
|
14
14
|
email:
|
@@ -48,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
48
|
version: 1.3.1
|
49
49
|
requirements: []
|
50
50
|
rubyforge_project:
|
51
|
-
rubygems_version: 2.4.
|
51
|
+
rubygems_version: 2.4.8
|
52
52
|
signing_key:
|
53
53
|
specification_version: 4
|
54
54
|
summary: logstash-core-event - The core event component of logstash
|