debian-mirror-gitlab/spec/lib/gitlab/sidekiq_status/client_middleware_spec.rb

26 lines
830 B
Ruby
Raw Normal View History

2019-12-04 20:38:33 +05:30
# frozen_string_literal: true
2022-01-26 12:08:38 +05:30
require 'fast_spec_helper'
2017-08-17 22:00:37 +05:30
2022-03-02 08:16:31 +05:30
RSpec.describe Gitlab::SidekiqStatus::ClientMiddleware, :clean_gitlab_redis_queues do
2017-08-17 22:00:37 +05:30
describe '#call' do
2022-01-26 12:08:38 +05:30
context 'when the job has status_expiration set' do
2022-03-02 08:16:31 +05:30
it 'tracks the job in Redis' do
expect(Gitlab::SidekiqStatus).to receive(:set).with('123', 1.hour.to_i)
2017-08-17 22:00:37 +05:30
2022-01-26 12:08:38 +05:30
described_class.new
.call('Foo', { 'jid' => '123', 'status_expiration' => 1.hour.to_i }, double(:queue), double(:pool)) { nil }
end
end
context 'when the job does not have status_expiration set' do
2022-03-02 08:16:31 +05:30
it 'does not track the job in Redis' do
expect(Gitlab::SidekiqStatus).to receive(:set).with('123', nil)
2022-01-26 12:08:38 +05:30
described_class.new
.call('Foo', { 'jid' => '123' }, double(:queue), double(:pool)) { nil }
end
2017-08-17 22:00:37 +05:30
end
end
end