Sha256: 1c892bce41c138a60d48aeb9eca887bc0bbbedca4945f370a04c7c3ade391df0

Contents?: true

Size: 823 Bytes

Versions: 12

Compression:

Stored size: 823 Bytes

Contents

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

describe LogStash::Outputs::UDP do

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

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

  describe "#send" do

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

    let(:properties) { { "message" => "This is a message!"} }
    let(:event)      { LogStash::Event.new(properties) }

    before(:each) do
      subject.register
    end

    it "should receive the generated event" do
      expect(subject.instance_variable_get("@socket")).to receive(:send).with(kind_of(String), 0, host, port)
      subject.receive(event)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
logstash-output-udp-3.0.6 spec/outputs/udp_spec.rb
logstash-output-udp-3.0.5 spec/outputs/udp_spec.rb
logstash-output-udp-3.0.4 spec/outputs/udp_spec.rb
logstash-output-udp-3.0.3 spec/outputs/udp_spec.rb
logstash-output-udp-3.0.2 spec/outputs/udp_spec.rb
logstash-output-udp-3.0.1 spec/outputs/udp_spec.rb
logstash-output-udp-3.0.0 spec/outputs/udp_spec.rb
logstash-output-udp-2.0.4 spec/outputs/udp_spec.rb
logstash-output-udp-2.0.2 spec/outputs/udp_spec.rb
logstash-output-udp-2.0.1 spec/outputs/udp_spec.rb
logstash-output-udp-2.0.0 spec/outputs/udp_spec.rb
logstash-output-udp-1.1.0 spec/outputs/udp_spec.rb