mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-20 18:16:45 +10:00
This ensures Rails and Sidekiq transactions are split into the series "rails_transactions" and "sidekiq_transactions" respectively.
27 lines
703 B
Ruby
27 lines
703 B
Ruby
require 'spec_helper'
|
|
|
|
describe Gitlab::Metrics::SidekiqMiddleware do
|
|
let(:middleware) { described_class.new }
|
|
|
|
describe '#call' do
|
|
it 'tracks the transaction' do
|
|
worker = Class.new.new
|
|
|
|
expect_any_instance_of(Gitlab::Metrics::Transaction).to receive(:finish)
|
|
|
|
middleware.call(worker, 'test', :test) { nil }
|
|
end
|
|
end
|
|
|
|
describe '#tag_worker' do
|
|
it 'adds the worker class and action to the transaction' do
|
|
trans = Gitlab::Metrics::Transaction.new
|
|
worker = double(:worker, class: double(:class, name: 'TestWorker'))
|
|
|
|
expect(trans).to receive(:add_tag).with(:action, 'TestWorker#perform')
|
|
|
|
middleware.tag_worker(trans, worker)
|
|
end
|
|
end
|
|
end
|