Sha256: e3d58dc63d2b3289e1293eb040b103a4d8d7565d59296e8e773c4ee105fae987

Contents?: true

Size: 960 Bytes

Versions: 11

Compression:

Stored size: 960 Bytes

Contents

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

describe LogStash::Outputs::Ganglia do

  it "should register without errors" do
    plugin = LogStash::Plugin.lookup("output", "ganglia").new("value" => "0", "metric" => "my.metric")
    expect { plugin.register }.to_not raise_error
  end

  describe "#send" do

    let(:value)  { 12345 }
    let(:metric) { "metric.mine" }
    subject { LogStash::Outputs::Ganglia.new("value" => "%{value}", "metric" => "%{metric}") }

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


    let(:host) { subject.host }
    let(:port) { subject.port }
    before(:each) do
      subject.register
    end

    it "should send the message to ganglia" do
      expect(Ganglia::GMetric).to receive(:send).with(host, port, hash_including(:name => metric, :value => value))
      subject.receive(event)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

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