rename BackgroundMigration to SidekiqMigration

This commit is contained in:
Pawel Chojnacki 2017-10-19 14:48:27 +03:00
parent 30a4bb6628
commit 735365a367
6 changed files with 17 additions and 4 deletions

View file

@ -1,6 +1,6 @@
module Gitlab
module Metrics
class SidekiqTransaction < Transaction
class BackgroundTransaction < Transaction
def initialize(worker_class)
super()
@worker_class = worker_class

View file

@ -5,7 +5,7 @@ module Gitlab
# This middleware is intended to be used as a server-side middleware.
class SidekiqMiddleware
def call(worker, message, queue)
trans = SidekiqTransaction.new(worker.class)
trans = BackgroundTransaction.new(worker.class)
begin
# Old gitlad-shell messages don't provide enqueued_at/created_at attributes

View file

@ -0,0 +1,13 @@
require 'spec_helper'
describe Gitlab::Metrics::BackgroundTransaction do
let(:test_worker_class) { double(:class, name: 'TestWorker') }
subject { described_class.new(test_worker_class) }
describe '#action' do
it 'returns transaction action name' do
expect(subject.action).to eq('TestWorker#perform')
end
end
end

View file

@ -32,7 +32,7 @@ describe Gitlab::Metrics::RackMiddleware do
let(:transaction) { middleware.transaction_from_env(env) }
it 'returns a Transaction' do
expect(transaction).to be_an_instance_of(Gitlab::Metrics::Transaction)
expect(transaction).to be_an_instance_of(Gitlab::Metrics::WebTransaction)
end
it 'stores the request method and URI in the transaction as values' do

View file

@ -5,7 +5,7 @@ describe Gitlab::Metrics::SidekiqMiddleware do
let(:message) { { 'args' => ['test'], 'enqueued_at' => Time.new(2016, 6, 23, 6, 59).to_f } }
def run(worker, message)
expect(Gitlab::Metrics::Transaction).to receive(:new)
expect(Gitlab::Metrics::BackgroundTransaction).to receive(:new)
.with(worker.class)
.and_call_original