summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/import/set_async_jid_spec.rb
blob: 513972801380ad7032b6229c43b456d3f7f17920 (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'

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.id}", StuckImportJobsWorker::IMPORT_JOBS_EXPIRATION)
              .and_call_original

      described_class.set_jid(project)
    end

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

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