2019-09-04 21:01:54 +05:30
|
|
|
# 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)
|
2020-06-23 00:09:42 +05:30
|
|
|
.with("async-import/project-import-state/#{project.id}", Gitlab::Import::StuckImportJob::IMPORT_JOBS_EXPIRATION)
|
2019-09-04 21:01:54 +05:30
|
|
|
.and_call_original
|
|
|
|
|
2020-04-22 19:07:51 +05:30
|
|
|
described_class.set_jid(project.import_state)
|
2019-09-04 21:01:54 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'updates the import JID of the project' do
|
2020-04-22 19:07:51 +05:30
|
|
|
described_class.set_jid(project.import_state)
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2020-04-22 19:07:51 +05:30
|
|
|
expect(project.import_state.reload.jid).to eq("async-import/project-import-state/#{project.id}")
|
2019-09-04 21:01:54 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|