diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-10-10 10:12:41 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-10-10 10:12:41 +0000 |
commit | 100a7c6b982d196b1f5570a8e47591015b5d638d (patch) | |
tree | f9582bb9a78c10ca24822db10b3efb709646c224 /spec | |
parent | 99806914a5ca382b22588de722a0db1c7a8bfff6 (diff) | |
parent | 5b32a4aaffc54c7ea9aca9e2745fcbcdbeae7a22 (diff) | |
download | gitlab-ce-100a7c6b982d196b1f5570a8e47591015b5d638d.tar.gz |
Merge branch 'ee-38771-ce-backport' into 'master'
Backports EE 38771 changes to CE.
See merge request gitlab-org/gitlab-ce!14782
Diffstat (limited to 'spec')
-rw-r--r-- | spec/workers/repository_fork_worker_spec.rb | 22 | ||||
-rw-r--r-- | spec/workers/repository_import_worker_spec.rb | 17 |
2 files changed, 39 insertions, 0 deletions
diff --git a/spec/workers/repository_fork_worker_spec.rb b/spec/workers/repository_fork_worker_spec.rb index d9e9409840f..e881ec37ae5 100644 --- a/spec/workers/repository_fork_worker_spec.rb +++ b/spec/workers/repository_fork_worker_spec.rb @@ -12,6 +12,28 @@ describe RepositoryForkWorker do end describe "#perform" do + describe 'when a worker was reset without cleanup' do + let(:jid) { '12345678' } + let(:started_project) { create(:project, :repository, :import_started) } + + it 'creates a new repository from a fork' do + allow(subject).to receive(:jid).and_return(jid) + + expect(shell).to receive(:fork_repository).with( + '/test/path', + project.full_path, + project.repository_storage_path, + fork_project.namespace.full_path + ).and_return(true) + + subject.perform( + project.id, + '/test/path', + project.full_path, + fork_project.namespace.full_path) + end + end + it "creates a new repository from a fork" do expect(shell).to receive(:fork_repository).with( '/test/path', diff --git a/spec/workers/repository_import_worker_spec.rb b/spec/workers/repository_import_worker_spec.rb index 100dfc32bbe..5cff5108477 100644 --- a/spec/workers/repository_import_worker_spec.rb +++ b/spec/workers/repository_import_worker_spec.rb @@ -6,6 +6,23 @@ describe RepositoryImportWorker do subject { described_class.new } describe '#perform' do + context 'when worker was reset without cleanup' do + let(:jid) { '12345678' } + let(:started_project) { create(:project, :import_started, import_jid: jid) } + + it 'imports the project successfully' do + allow(subject).to receive(:jid).and_return(jid) + + expect_any_instance_of(Projects::ImportService).to receive(:execute) + .and_return({ status: :ok }) + + expect_any_instance_of(Repository).to receive(:expire_emptiness_caches) + expect_any_instance_of(Project).to receive(:import_finish) + + subject.perform(project.id) + end + end + context 'when the import was successful' do it 'imports a project' do expect_any_instance_of(Projects::ImportService).to receive(:execute) |