Sha256: 29ad856433d7dff636a9f4c4f6dc87de6a853d95f11f1f669ef19f9ee7e4e6c9

Contents?: true

Size: 1.91 KB

Versions: 17

Compression:

Stored size: 1.91 KB

Contents

# frozen_string_literal: true
[
    File.join(File.dirname(__FILE__), '..'),
    File.join(File.dirname(__FILE__), '..', 'lib/fluent/plugin'),
    File.join(File.dirname(__FILE__), '..', 'spec'),
].each do |dir|
  $LOAD_PATH.unshift(dir) unless $LOAD_PATH.include?(dir)
end

require 'newrelic_metrics_parser'
require 'date'
require 'rspec'


RSpec.describe NewRelicMetricsParser do
  describe "#emit_parsed_metrics" do
    it 'should read sample Artifactory metrics data and verify the size of parsed data > 1' do
      platform_metrics = File.read('./spec/fixtures/files/sample_artifactory_metrics.txt')
      expect(platform_metrics.size).to be > 1

      parser = NewRelicMetricsParser.new('jfrog.artifactory', '', 'jfrog.artifactory.metrics')

      normalized_data = parser.normalise_data(platform_metrics)
      expect(normalized_data.size).to be > 1

      cleaned_data = parser.clean_data(normalized_data)
      expect(cleaned_data.size).to be > 1

      hash_data_array = parser.format_data(cleaned_data, 'jfrog.artifactory', '.')
      expect(hash_data_array.size).to be 1

      serialized_data = parser.serialize_data(hash_data_array)
      expect(serialized_data.size).to be 1
    end

    it 'should read sample Xray metrics data and verify the size of parsed data > 1' do
      platform_metrics = File.read('./spec/fixtures/files/sample_xray_metrics.txt')
      expect(platform_metrics.size).to be > 1

      parser = NewRelicMetricsParser.new('jfrog.xray', '', 'jfrog.xray.metrics')

      normalized_data = parser.normalise_data(platform_metrics)
      expect(normalized_data.size).to be > 1

      cleaned_data = parser.clean_data(normalized_data)
      expect(cleaned_data.size).to be > 1

      hash_data_array = parser.format_data(cleaned_data, 'jfrog.xray', '.')
      expect(hash_data_array.size).to be  1

      serialized_data = parser.serialize_data(hash_data_array)
      expect(serialized_data.size).to be  1
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
fluent-plugin-jfrog-metrics-0.2.13 spec/lib/newrelic_metrics_parser_spec.rb
fluent-plugin-jfrog-metrics-0.2.12.3 spec/lib/newrelic_metrics_parser_spec.rb
fluent-plugin-jfrog-metrics-0.2.12.2 spec/lib/newrelic_metrics_parser_spec.rb
fluent-plugin-jfrog-metrics-0.2.12.1 spec/lib/newrelic_metrics_parser_spec.rb
fluent-plugin-jfrog-metrics-0.2.12 spec/lib/newrelic_metrics_parser_spec.rb
fluent-plugin-jfrog-metrics-0.2.11 spec/lib/newrelic_metrics_parser_spec.rb
fluent-plugin-jfrog-metrics-0.2.10 spec/lib/newrelic_metrics_parser_spec.rb
fluent-plugin-jfrog-metrics-0.2.9 spec/lib/newrelic_metrics_parser_spec.rb
fluent-plugin-jfrog-metrics-0.2.8 spec/lib/newrelic_metrics_parser_spec.rb
fluent-plugin-jfrog-metrics-0.2.7 spec/lib/newrelic_metrics_parser_spec.rb
fluent-plugin-jfrog-metrics-0.2.6 spec/lib/newrelic_metrics_parser_spec.rb
fluent-plugin-jfrog-metrics-0.2.5 spec/lib/newrelic_metrics_parser_spec.rb
fluent-plugin-jfrog-metrics-0.2.4 spec/lib/newrelic_metrics_parser_spec.rb
fluent-plugin-jfrog-metrics-0.2.3 spec/lib/newrelic_metrics_parser_spec.rb
fluent-plugin-jfrog-metrics-0.2.2 spec/lib/newrelic_metrics_parser_spec.rb
fluent-plugin-jfrog-metrics-0.2.1 spec/lib/newrelic_metrics_parser_spec.rb
fluent-plugin-jfrog-metrics-0.2.0 spec/lib/newrelic_metrics_parser_spec.rb