Fix tests by latest proposal changes

This commit is contained in:
Shinya Maeda 2018-03-06 21:40:50 +09:00
parent 335bc0fec0
commit 0ac1322045
7 changed files with 7 additions and 37 deletions

View File

@ -698,10 +698,10 @@ describe API::Runner do
end
end
context 'when tace is given' do
context 'when trace is given' do
it 'creates a trace artifact' do
allow(BuildFinishedWorker).to receive(:perform_async).with(job.id) do
CreateTraceArtifactWorker.new.perform(job.id)
ArchiveTraceWorker.new.perform(job.id)
end
update_job(state: 'success', trace: 'BUILD TRACE UPDATED')

View File

@ -7,7 +7,7 @@ describe 'gitlab:traces rake tasks' do
shared_examples 'passes the job id to worker' do
it do
expect(ArchiveLegacyTraceWorker).to receive(:bulk_perform_async).with([[job.id]])
expect(ArchiveTraceWorker).to receive(:bulk_perform_async).with([[job.id]])
run_rake_task('gitlab:traces:archive')
end
@ -15,7 +15,7 @@ describe 'gitlab:traces rake tasks' do
shared_examples 'does not pass the job id to worker' do
it do
expect(ArchiveLegacyTraceWorker).not_to receive(:bulk_perform_async)
expect(ArchiveTraceWorker).not_to receive(:bulk_perform_async)
run_rake_task('gitlab:traces:archive')
end

View File

@ -1,30 +0,0 @@
require 'spec_helper'
describe ArchiveLegacyTraceWorker do
it { is_expected.to be_a(ObjectStorageQueue) }
it { is_expected.not_to be_a(PipelineQueue) }
describe '#perform' do
subject { described_class.new.perform(job&.id) }
context 'when job is found' do
let(:job) { create(:ci_build) }
it 'executes service' do
expect_any_instance_of(Gitlab::Ci::Trace).to receive(:archive!)
subject
end
end
context 'when job is not found' do
let(:job) { nil }
it 'does not execute service' do
expect_any_instance_of(Gitlab::Ci::Trace).not_to receive(:archive!)
subject
end
end
end
end

View File

@ -1,6 +1,6 @@
require 'spec_helper'
describe CreateTraceArtifactWorker do
describe ArchiveTraceWorker do
describe '#perform' do
subject { described_class.new.perform(job&.id) }

View File

@ -14,7 +14,7 @@ describe BuildFinishedWorker do
expect_any_instance_of(BuildTraceSectionsWorker).to receive(:perform)
expect_any_instance_of(BuildCoverageWorker).to receive(:perform)
expect(BuildHooksWorker).to receive(:perform_async)
expect(CreateTraceArtifactWorker).to receive(:perform_async)
expect(ArchiveTraceWorker).to receive(:perform_async)
described_class.new.perform(build.id)
end

View File

@ -14,6 +14,6 @@ describe PipelineBackgroundQueue do
it 'sets a default object storage queue automatically' do
expect(worker.sidekiq_options['queue'])
.to eq 'object_storage:dummy'
.to eq 'pipeline_background:dummy'
end
end