rename BackgroundMigration to SidekiqMigration
This commit is contained in:
parent
30a4bb6628
commit
735365a367
6 changed files with 17 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
module Gitlab
|
||||
module Metrics
|
||||
class SidekiqTransaction < Transaction
|
||||
class BackgroundTransaction < Transaction
|
||||
def initialize(worker_class)
|
||||
super()
|
||||
@worker_class = worker_class
|
|
@ -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
|
||||
|
|
13
spec/lib/gitlab/metrics/background_transaction_spec.rb
Normal file
13
spec/lib/gitlab/metrics/background_transaction_spec.rb
Normal 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
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue