Sha256: 8f0f3a89168bbe8d64f5feeb5b015e9ed4d1f045f1fefbe4f4233c49e84e7686

Contents?: true

Size: 1.13 KB

Versions: 17

Compression:

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


RSpec.describe MetricsHelper do
  jpd_url, username, apikey, token = get_credentials
  describe '#get_metrics' do
    it 'should return response code 200 and response body > 1' do
      response = RestClient::Request.new(
        method: :get,
        url: "#{jpd_url}/artifactory/api/v1/metrics",
        user: username.to_s,
        password: apikey.to_s
      ).execute do |response, request, result|
        expect(response.code).to eq(200)
        expect(response.size).to be > 1
      end
    end

    it 'should return response code 200 and response body > 1' do
      helper = MetricsHelper.new('jfrog.artifactory', jpd_url, username, apikey, token)
      url = "#{jpd_url}/observability/api/v1/metrics"
      helper.check_endpoint(url, token)
    end

  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

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