Skip to content

Commit

Permalink
Fix failing spec - caused by revert of Java Event
Browse files Browse the repository at this point in the history
Fixes #39
  • Loading branch information
Guy Boertje committed Apr 14, 2016
1 parent 913365d commit c28c580
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 35 deletions.
9 changes: 4 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# 2.0.7
- Fix failing test caused by reverting Java Event back to Ruby Event
# 2.0.6
- Fix plugin crash when Logstash::Json fails to parse a message, https://github.com/logstash-plugins/logstash-input-gelf/pull/27

# 2.0.5
- Depend on logstash-core-plugin-api instead of logstash-core, removing the need to mass update plugins on major releases of logstash
# 2.0.4
- New dependency requirements for logstash-core for the 5.0 release
## 2.0.3
# 2.0.3
- Fix Timestamp coercion to preserve upto microsecond precision, https://github.com/logstash-plugins/logstash-input-gelf/pull/35

## 2.0.0
# 2.0.0
- Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
instead of using Thread.raise on the plugins' threads. Ref: https://github.com/elastic/logstash/pull/3895
- Dependency on logstash-core update to 2.0

1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Contributors:
* Richard Pijnenburg (electrical)
* Suyog Rao (suyograo)
* joe miller (joemiller)
* Guy Boertje (guyboertje)

Note: If you've sent us patches, bug reports, or otherwise contributed to
Logstash, and you aren't on the list above and want to be, please let us know
Expand Down
3 changes: 1 addition & 2 deletions logstash-input-gelf.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|

s.name = 'logstash-input-gelf'
s.version = '2.0.6'
s.version = '2.0.7'
s.licenses = ['Apache License (2.0)']
s.summary = "This input will read GELF messages as events over the network, making it a good choice if you already use Graylog2 today."
s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
Expand Down Expand Up @@ -30,4 +30,3 @@ Gem::Specification.new do |s|
s.add_development_dependency "gelf", ["1.3.2"] #(MIT license)
s.add_development_dependency "flores"
end

51 changes: 23 additions & 28 deletions spec/inputs/gelf_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,42 +150,37 @@
context "when an invalid JSON is fed to the listener" do
subject { LogStash::Inputs::Gelf.new_event(message, "host") }
let(:message) { "Invalid JSON message" }
if LogStash::Event.respond_to?(:from_java)
context "default :from_json parser output" do
it { should be_a(LogStash::Event) }

context "legacy JSON parser output" do
before(:each) do
expect(LogStash::Inputs::Gelf).to receive(:parse) do |line|
LogStash::Inputs::Gelf.send(:legacy_parse, line)
it "falls back to plain-text" do
expect(subject["message"]).to eq(message)
end
end

it { should be_a(LogStash::Event) }

it "falls back to plain-text" do
expect(subject["message"]).to eq(message)
end

it "tags message with _jsonparsefailure" do
expect(subject["tags"]).to include("_jsonparsefailure")
end
it "tags message with _jsonparsefailure" do
expect(subject["tags"]).to include("_jsonparsefailure")
end

it "tags message with _legacyjsonparser" do
expect(subject["tags"]).to include("_legacyjsonparser")
it "tags message with _fromjsonparser" do
expect(subject["tags"]).to include("_fromjsonparser")
end
end
end

context "default :from_json parser output" do
it { should be_a(LogStash::Event) }
else
context "legacy JSON parser output" do
it { should be_a(LogStash::Event) }

it "falls back to plain-text" do
expect(subject["message"]).to eq(message)
end
it "falls back to plain-text" do
expect(subject["message"]).to eq(message)
end

it "tags message with _jsonparsefailure" do
expect(subject["tags"]).to include("_jsonparsefailure")
end
it "tags message with _jsonparsefailure" do
expect(subject["tags"]).to include("_jsonparsefailure")
end

it "tags message with _fromjsonparser" do
expect(subject["tags"]).to include("_fromjsonparser")
it "tags message with _legacyjsonparser" do
expect(subject["tags"]).to include("_legacyjsonparser")
end
end
end
end
Expand Down

0 comments on commit c28c580

Please sign in to comment.