Welcome to mirror list, hosted at ThFree Co, Russian Federation.

set_async_jid_spec.rb « import « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 016f7cac61a43df632d5b31200914fb0fa06f69f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true
require 'spec_helper'

RSpec.describe Gitlab::Import::SetAsyncJid do
  describe '.set_jid', :clean_gitlab_redis_shared_state do
    let(:project) { create(:project, :import_scheduled) }

    it 'sets the JID in Redis' do
      expect(Gitlab::SidekiqStatus)
        .to receive(:set)
              .with("async-import/project-import-state/#{project.id}", Gitlab::Import::StuckImportJob::IMPORT_JOBS_EXPIRATION, value: 2)
              .and_call_original

      described_class.set_jid(project.import_state)
    end

    it 'updates the import JID of the project' do
      described_class.set_jid(project.import_state)

      expect(project.import_state.reload.jid).to eq("async-import/project-import-state/#{project.id}")
    end
  end
end