spec/inputs/gelf_spec.rb in logstash-input-gelf-2.0.7 vs spec/inputs/gelf_spec.rb in logstash-input-gelf-2.0.8

- old
+ new

@@ -51,11 +51,11 @@ sleep(0.1) end gelfclient.notify!("short_message" => "start") e = queue.pop - while (e["message"] != "start") + while (e.get("message") != "start") e = queue.pop end messages.each do |m| gelfclient.notify!("short_message" => m) @@ -63,12 +63,12 @@ messages.map{queue.pop} end events.each_with_index do |e, i| - insist { e["message"] } == messages[i] - insist { e["host"] } == Socket.gethostname + insist { e.get("message") } == messages[i] + insist { e.get("host") } == Socket.gethostname end end context "timestamp coercion" do # these test private methods, this is advisable for now until we roll out this coercion in the Timestamp class @@ -148,39 +148,40 @@ end 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) + + if LogStash::Event.respond_to?(:from_json) context "default :from_json parser output" do it { should be_a(LogStash::Event) } it "falls back to plain-text" do - expect(subject["message"]).to eq(message) + expect(subject.get("message")).to eq(message) end it "tags message with _jsonparsefailure" do - expect(subject["tags"]).to include("_jsonparsefailure") + expect(subject.get("tags")).to include("_jsonparsefailure") end it "tags message with _fromjsonparser" do - expect(subject["tags"]).to include("_fromjsonparser") + expect(subject.get("tags")).to include("_fromjsonparser") end end 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) + expect(subject.get("message")).to eq(message) end it "tags message with _jsonparsefailure" do - expect(subject["tags"]).to include("_jsonparsefailure") + expect(subject.get("tags")).to include("_jsonparsefailure") end it "tags message with _legacyjsonparser" do - expect(subject["tags"]).to include("_legacyjsonparser") + expect(subject.get("tags")).to include("_legacyjsonparser") end end end end end