Sha256: e2974e2b9e4cadce9f528b9207f6b59fc29d741e341dc2cc766acd6a544bccb8

Contents?: true

Size: 1.86 KB

Versions: 1

Compression:

Stored size: 1.86 KB

Contents

require 'spec_helper'

describe Gitlab::Client do
  describe ".sidekiq_queue_metrics" do
    before do
      stub_get("/sidekiq/queue_metrics", 'sidekiq_queue_metrics')
      @sidekiq_queue_metrics = Gitlab.sidekiq_queue_metrics
    end

    it "gets the correct resource" do
      expect(a_get("/sidekiq/queue_metrics")).to have_been_made
    end

    it "returns a information about a sidekiq default queue" do
      expect(@sidekiq_queue_metrics.queues.default.backlog).to eq 0
      expect(@sidekiq_queue_metrics.queues.default.latency).to eq 0
    end
  end

  describe ".sidekiq_process_metrics" do
    before do
      stub_get("/sidekiq/process_metrics", 'sidekiq_process_metrics')
      @sidekiq_process_metrics = Gitlab.sidekiq_process_metrics
    end

    it "gets the correct resource" do
      expect(a_get("/sidekiq/process_metrics")).to have_been_made
    end

    it "returns a information about a sidekiq process metrics" do
      expect(@sidekiq_process_metrics.processes.first['busy']).to eq 0
    end
  end

  describe ".sidekiq_job_stats" do
    before do
      stub_get("/sidekiq/job_stats", 'sidekiq_job_stats')
      @sidekiq_job_stats = Gitlab.sidekiq_job_stats
    end

    it "gets the correct resource" do
      expect(a_get("/sidekiq/job_stats")).to have_been_made
    end

    it "returns a information about a sidekiq process metrics" do
      expect(@sidekiq_job_stats.jobs.processed).to eq 2
    end
  end

  describe ".sidekiq_compound_metrics" do
    before do
      stub_get("/sidekiq/compound_metrics", 'sidekiq_compound_metrics')
      @sidekiq_compound_metrics = Gitlab.sidekiq_compound_metrics
    end

    it "gets the correct resource" do
      expect(a_get("/sidekiq/compound_metrics")).to have_been_made
    end

    it "returns a information about a sidekiq process metrics" do
      expect(@sidekiq_compound_metrics.jobs.processed).to eq 2
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gitlab-4.4.0 spec/gitlab/client/sidekiq_spec.rb