Sha256: 123cf6c9cb0d99e612d07907897f4d0d5cd6d0e7a81c57f64fc02472b207a6b6

Contents?: true

Size: 1.1 KB

Versions: 13

Compression:

Stored size: 1.1 KB

Contents

# encoding: utf-8
require_relative "../spec_helper"
require "gelf"

describe LogStash::Outputs::Gelf do

  let(:host) { "localhost" }
  let(:port) { rand(1024..65535) }

  it "should register without errors" do
    plugin = LogStash::Plugin.lookup("output", "gelf").new("host" => host, "port" => port)
    expect { plugin.register }.to_not raise_error
  end

  describe "#send" do

    subject { LogStash::Outputs::Gelf.new("host" => host, "port" => port ) }

    let(:properties) { { "message" => "This is a message!"} }
    let(:event)      { LogStash::Event.new(properties) }
    let(:gelf)       { GELF::Notifier.new(host, port, subject.chunksize) }

    before(:each) do
      subject.inject_client(gelf)
      subject.register
    end

    it "sends the generated event to gelf" do
      expect(subject.gelf).to receive(:notify!).with(hash_including("short_message"=>"This is a message!",
                                                                    "full_message"=>"This is a message!"),
                                                     hash_including(:timestamp))
      subject.receive(event)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
logstash-output-gelf-3.1.7 spec/outputs/gelf_spec.rb
logstash-output-gelf-3.1.4 spec/outputs/gelf_spec.rb
logstash-output-gelf-3.1.3 spec/outputs/gelf_spec.rb
logstash-output-gelf-3.1.2 spec/outputs/gelf_spec.rb
logstash-output-gelf-3.1.1 spec/outputs/gelf_spec.rb
logstash-output-gelf-3.0.1 spec/outputs/gelf_spec.rb
logstash-output-gelf-3.0.0 spec/outputs/gelf_spec.rb
logstash-output-gelf-2.0.5 spec/outputs/gelf_spec.rb
logstash-output-gelf-2.0.3 spec/outputs/gelf_spec.rb
logstash-output-gelf-2.0.2 spec/outputs/gelf_spec.rb
logstash-output-gelf-2.0.1 spec/outputs/gelf_spec.rb
logstash-output-gelf-2.0.0 spec/outputs/gelf_spec.rb
logstash-output-gelf-1.1.0 spec/outputs/gelf_spec.rb