Sha256: ac9e4fb50c1f134bc215371592303251340ffc1ac8bbff5fe0cee55e59e12623

Contents?: true

Size: 1.07 KB

Versions: 105

Compression:

Stored size: 1.07 KB

Contents

# encoding: utf-8
require "logstash/instrument/namespaced_null_metric"
require "logstash/instrument/null_metric"
require_relative "../../support/matchers"
require "spec_helper"

describe LogStash::Instrument::NamespacedNullMetric do
  let(:namespace) { :root }
  let(:collector) { [] }
  let(:metric) { LogStash::Instrument::NullMetric.new(collector) }

  subject { described_class.new(metric, namespace) }

  it "defines the same interface as `Metric`" do
    expect(described_class).to implement_interface_of(LogStash::Instrument::NamespacedMetric)
  end

  it "returns a TimedException when we call without a block" do
    expect(subject.time(:duration_ms)).to be(LogStash::Instrument::NullMetric::NullTimedExecution)
  end

  it "returns the value of the block" do
    expect(subject.time(:duration_ms) { "hello" }).to eq("hello")
  end

  it "its doesnt change the original `namespace` when creating a subnamespace" do
    new_namespace = subject.namespace(:wally)

    expect(subject.namespace_name).to eq([namespace])
    expect(new_namespace.namespace_name).to eq([:root, :wally])
  end

end

Version data entries

105 entries across 102 versions & 11 rubygems

Version Path
logstash-core-5.5.0-java spec/logstash/instrument/namespaced_null_metric_spec.rb
logstash-core-5.4.3-java spec/logstash/instrument/namespaced_null_metric_spec.rb
logstash-core-5.4.2-java spec/logstash/instrument/namespaced_null_metric_spec.rb
logstash-filter-csharp-0.1.0 vendor/bundle/jruby/2.3.0/gems/logstash-core-5.2.1-java/spec/logstash/instrument/namespaced_null_metric_spec.rb
logstash-core-6.0.0.alpha2-java spec/logstash/instrument/namespaced_null_metric_spec.rb
logstash-core-5.4.1-java spec/logstash/instrument/namespaced_null_metric_spec.rb
logstash-core-5.3.3-java spec/logstash/instrument/namespaced_null_metric_spec.rb
logstash-filter-htmlentities-0.1.0 vendor/bundle/jruby/1.9/gems/logstash-core-5.4.0-java/spec/logstash/instrument/namespaced_null_metric_spec.rb
logstash-output-icinga-1.0.0 vendor/jruby/1.9/gems/logstash-core-5.2.1-java/spec/logstash/instrument/namespaced_null_metric_spec.rb
logstash-core-6.0.0.alpha1-java spec/logstash/instrument/namespaced_null_metric_spec.rb
logstash-core-5.4.0-java spec/logstash/instrument/namespaced_null_metric_spec.rb
logstash-core-5.3.2-java spec/logstash/instrument/namespaced_null_metric_spec.rb
logstash-core-5.3.1-java spec/logstash/instrument/namespaced_null_metric_spec.rb
logstash-core-5.3.0-java spec/logstash/instrument/namespaced_null_metric_spec.rb
logstash-core-5.2.2-java spec/logstash/instrument/namespaced_null_metric_spec.rb
logstash-input-fifo-0.9.1 vendor/bundle/jruby/1.9/gems/logstash-core-5.1.1.1-java/spec/logstash/instrument/namespaced_null_metric_spec.rb
logstash-input-fifo-0.9.0 vendor/bundle/jruby/1.9/gems/logstash-core-5.1.1.1-java/spec/logstash/instrument/namespaced_null_metric_spec.rb
logstash-core-5.2.1-java spec/logstash/instrument/namespaced_null_metric_spec.rb
logstash-core-5.2.0-java spec/logstash/instrument/namespaced_null_metric_spec.rb
logstash-input-salesforce-3.0.0 vendor/jruby/1.9/gems/logstash-core-5.1.1.1-java/spec/logstash/instrument/namespaced_null_metric_spec.rb