2019-10-28 20:06:10 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-06-14 19:38:54 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 02:09:01 -04:00
|
|
|
RSpec.describe API::SidekiqMetrics do
|
2016-06-14 19:38:54 -04:00
|
|
|
let(:admin) { create(:user, :admin) }
|
|
|
|
|
|
|
|
describe 'GET sidekiq/*' do
|
|
|
|
it 'defines the `queue_metrics` endpoint' do
|
|
|
|
get api('/sidekiq/queue_metrics', admin)
|
|
|
|
|
2020-03-02 13:07:42 -05:00
|
|
|
expect(response).to have_gitlab_http_status(:ok)
|
2016-06-14 19:38:54 -04:00
|
|
|
expect(json_response).to be_a Hash
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'defines the `process_metrics` endpoint' do
|
|
|
|
get api('/sidekiq/process_metrics', admin)
|
|
|
|
|
2020-03-02 13:07:42 -05:00
|
|
|
expect(response).to have_gitlab_http_status(:ok)
|
2016-06-14 19:38:54 -04:00
|
|
|
expect(json_response['processes']).to be_an Array
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'defines the `job_stats` endpoint' do
|
|
|
|
get api('/sidekiq/job_stats', admin)
|
|
|
|
|
2020-03-02 13:07:42 -05:00
|
|
|
expect(response).to have_gitlab_http_status(:ok)
|
2016-06-14 19:38:54 -04:00
|
|
|
expect(json_response).to be_a Hash
|
2019-11-18 10:06:27 -05:00
|
|
|
expect(json_response['jobs']).to be_a Hash
|
|
|
|
expect(json_response['jobs'].keys)
|
|
|
|
.to contain_exactly(*%w[processed failed enqueued dead])
|
|
|
|
expect(json_response['jobs'].values).to all(be_an(Integer))
|
2016-06-14 19:38:54 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'defines the `compound_metrics` endpoint' do
|
|
|
|
get api('/sidekiq/compound_metrics', admin)
|
|
|
|
|
2020-03-02 13:07:42 -05:00
|
|
|
expect(response).to have_gitlab_http_status(:ok)
|
2016-06-14 19:38:54 -04:00
|
|
|
expect(json_response).to be_a Hash
|
|
|
|
expect(json_response['queues']).to be_a Hash
|
|
|
|
expect(json_response['processes']).to be_an Array
|
|
|
|
expect(json_response['jobs']).to be_a Hash
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|