Sha256: 6daa49765b0e30fa049916d71ec7e64cc5796ce5767da4ee54c9b395c358dbee

Contents?: true

Size: 862 Bytes

Versions: 106

Compression:

Stored size: 862 Bytes

Contents

# encoding: utf-8
require "logstash/instrument/metric_type/gauge"
require "logstash/json"
require "spec_helper"

describe LogStash::Instrument::MetricType::Gauge do
  let(:namespaces) { [:root, :pipelines, :pipeline_01] }
  let(:key) { :mykey }
  let(:value) { "hello" }

  subject { described_class.new(namespaces, key) }

  before :each do
    subject.execute(:set, value)
  end

  describe "#execute" do
    it "set the value of the gauge" do
      expect(subject.value).to eq(value)
    end
  end

  context "When serializing to JSON" do
    it "serializes the value" do
      expect(LogStash::Json.dump(subject)).to eq("\"#{value}\"")
    end
  end

  context "When creating a hash " do
    it "creates the hash from all the values" do
      metric_hash = {
        key => value
      }
      expect(subject.to_hash).to match(metric_hash)
    end
  end
end

Version data entries

106 entries across 103 versions & 14 rubygems

Version Path
mrcooper-logstash-output-azuresearch-0.2.2 vendor/jruby/2.5.0/gems/logstash-core-5.0.0-java/spec/logstash/instrument/metric_type/gauge_spec.rb
logstash-core-5.6.10-java spec/logstash/instrument/metric_type/gauge_spec.rb
logstash-core-5.6.9-java spec/logstash/instrument/metric_type/gauge_spec.rb
logstash-core-5.6.8-java spec/logstash/instrument/metric_type/gauge_spec.rb
logstash-core-5.6.7-java spec/logstash/instrument/metric_type/gauge_spec.rb
logstash-core-5.6.6-java spec/logstash/instrument/metric_type/gauge_spec.rb
logstash-core-5.6.5-java spec/logstash/instrument/metric_type/gauge_spec.rb
logstash-core-5.6.4-java spec/logstash/instrument/metric_type/gauge_spec.rb
logstash-core-5.6.3-java spec/logstash/instrument/metric_type/gauge_spec.rb
logstash-output-icinga-1.1.0 vendor/jruby/1.9/gems/logstash-core-5.2.1-java/spec/logstash/instrument/metric_type/gauge_spec.rb
logstash-output-icinga-1.1.0 vendor/jruby/2.3.0/gems/logstash-core-5.2.1-java/spec/logstash/instrument/metric_type/gauge_spec.rb
logstash-core-5.6.2-java spec/logstash/instrument/metric_type/gauge_spec.rb
logstash-core-5.6.1-java spec/logstash/instrument/metric_type/gauge_spec.rb
logstash-core-5.5.3-java spec/logstash/instrument/metric_type/gauge_spec.rb
logstash-core-5.6.0-java spec/logstash/instrument/metric_type/gauge_spec.rb
logstash-core-5.5.2-java spec/logstash/instrument/metric_type/gauge_spec.rb
logstash-core-5.5.1-java spec/logstash/instrument/metric_type/gauge_spec.rb
logstash-filter-cache-redis-0.3.1 vendor/bundle/jruby/1.9/gems/logstash-core-5.5.1.snapshot1-java/spec/logstash/instrument/metric_type/gauge_spec.rb
logstash-filter-cache-redis-0.3.0 vendor/bundle/jruby/1.9/gems/logstash-core-5.5.1.snapshot1-java/spec/logstash/instrument/metric_type/gauge_spec.rb
logstash-core-5.5.1.snapshot1-java spec/logstash/instrument/metric_type/gauge_spec.rb