Sha256: 69b4843202d051e83c0e279e246a23e95aa550caa3ace5ab14db3071664511f1

Contents?: true

Size: 1.74 KB

Versions: 14

Compression:

Stored size: 1.74 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_sender'
require 'date'
require 'rspec'
require 'rest-client'
require './spec/fixtures/files/creds'


RSpec.describe NewRelicMetrics do
  newrelic_apikey, url = get_newrelic_credentials
  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_newrelic_metrics.txt')
      expect(platform_metrics.size).to be > 1

      response = RestClient::Request.new(
          method: :post,
          url: url,
          payload: platform_metrics,
          headers: {params: {'Api-Key' => newrelic_apikey, "Content-Type" => "application/json"}}
      ).execute do |response, request, result|
        puts response
        expect(response.code).to eq(202)
        expect(response.size).to be > 1
      end
    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_newrelic_metrics.txt')
      expect(platform_metrics.size).to be > 1

      response = RestClient::Request.new(
          method: :post,
          url: url,
          payload: platform_metrics,
          headers: {params: {'Api-Key' => newrelic_apikey, "Content-Type" => "application/json"}}
      ).execute do |response, request, result|
        puts response
        expect(response.code).to eq(202)
        expect(response.size).to be > 1
      end
    end

  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
fluent-plugin-jfrog-send-metrics-0.1.11 spec/lib/newrelic_metrics_sender_spec.rb
fluent-plugin-jfrog-send-metrics-0.1.10.3 spec/lib/newrelic_metrics_sender_spec.rb
fluent-plugin-jfrog-send-metrics-0.1.10.2 spec/lib/newrelic_metrics_sender_spec.rb
fluent-plugin-jfrog-send-metrics-0.1.10.1 spec/lib/newrelic_metrics_sender_spec.rb
fluent-plugin-jfrog-send-metrics-0.1.10 spec/lib/newrelic_metrics_sender_spec.rb
fluent-plugin-jfrog-send-metrics-0.1.9 spec/lib/newrelic_metrics_sender_spec.rb
fluent-plugin-jfrog-send-metrics-0.1.8 spec/lib/newrelic_metrics_sender_spec.rb
fluent-plugin-jfrog-send-metrics-0.1.7 spec/lib/newrelic_metrics_sender_spec.rb
fluent-plugin-jfrog-send-metrics-0.1.6 spec/lib/newrelic_metrics_sender_spec.rb
fluent-plugin-jfrog-send-metrics-0.1.5 spec/lib/newrelic_metrics_sender_spec.rb
fluent-plugin-jfrog-send-metrics-0.1.4 spec/lib/newrelic_metrics_sender_spec.rb
fluent-plugin-jfrog-send-metrics-0.1.3 spec/lib/newrelic_metrics_sender_spec.rb
fluent-plugin-jfrog-send-metrics-0.1.2 spec/lib/newrelic_metrics_sender_spec.rb
fluent-plugin-jfrog-send-metrics-0.1.1 spec/lib/newrelic_metrics_sender_spec.rb