Commit 735365a3 authored by Pawel Chojnacki's avatar Pawel Chojnacki

rename BackgroundMigration to SidekiqMigration

parent 30a4bb66
module Gitlab module Gitlab
module Metrics module Metrics
class SidekiqTransaction < Transaction class BackgroundTransaction < Transaction
def initialize(worker_class) def initialize(worker_class)
super() super()
@worker_class = worker_class @worker_class = worker_class
......
...@@ -5,7 +5,7 @@ module Gitlab ...@@ -5,7 +5,7 @@ module Gitlab
# This middleware is intended to be used as a server-side middleware. # This middleware is intended to be used as a server-side middleware.
class SidekiqMiddleware class SidekiqMiddleware
def call(worker, message, queue) def call(worker, message, queue)
trans = SidekiqTransaction.new(worker.class) trans = BackgroundTransaction.new(worker.class)
begin begin
# Old gitlad-shell messages don't provide enqueued_at/created_at attributes # Old gitlad-shell messages don't provide enqueued_at/created_at attributes
......
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
...@@ -32,7 +32,7 @@ describe Gitlab::Metrics::RackMiddleware do ...@@ -32,7 +32,7 @@ describe Gitlab::Metrics::RackMiddleware do
let(:transaction) { middleware.transaction_from_env(env) } let(:transaction) { middleware.transaction_from_env(env) }
it 'returns a Transaction' do 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 end
it 'stores the request method and URI in the transaction as values' do it 'stores the request method and URI in the transaction as values' do
......
...@@ -5,7 +5,7 @@ describe Gitlab::Metrics::SidekiqMiddleware do ...@@ -5,7 +5,7 @@ describe Gitlab::Metrics::SidekiqMiddleware do
let(:message) { { 'args' => ['test'], 'enqueued_at' => Time.new(2016, 6, 23, 6, 59).to_f } } let(:message) { { 'args' => ['test'], 'enqueued_at' => Time.new(2016, 6, 23, 6, 59).to_f } }
def run(worker, message) def run(worker, message)
expect(Gitlab::Metrics::Transaction).to receive(:new) expect(Gitlab::Metrics::BackgroundTransaction).to receive(:new)
.with(worker.class) .with(worker.class)
.and_call_original .and_call_original
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment