diff options
Diffstat (limited to 'spec/models/ci/build_spec.rb')
-rw-r--r-- | spec/models/ci/build_spec.rb | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index e3ee533688a..3d06fd6db4f 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -1185,60 +1185,6 @@ RSpec.describe Ci::Build do end end - describe 'state transition with resource group' do - let(:resource_group) { create(:ci_resource_group, project: project) } - - context 'when build status is created' do - let(:build) { create(:ci_build, :created, project: project, resource_group: resource_group) } - - it 'is waiting for resource when build is enqueued' do - expect(Ci::ResourceGroups::AssignResourceFromResourceGroupWorker).to receive(:perform_async).with(resource_group.id) - - expect { build.enqueue! }.to change { build.status }.from('created').to('waiting_for_resource') - - expect(build.waiting_for_resource_at).not_to be_nil - end - - context 'when build is waiting for resource' do - before do - build.update_column(:status, 'waiting_for_resource') - end - - it 'is enqueued when build requests resource' do - expect { build.enqueue_waiting_for_resource! }.to change { build.status }.from('waiting_for_resource').to('pending') - end - - it 'releases a resource when build finished' do - expect(build.resource_group).to receive(:release_resource_from).with(build).and_call_original - expect(Ci::ResourceGroups::AssignResourceFromResourceGroupWorker).to receive(:perform_async).with(build.resource_group_id) - - build.enqueue_waiting_for_resource! - build.success! - end - - context 'when build has prerequisites' do - before do - allow(build).to receive(:any_unmet_prerequisites?) { true } - end - - it 'is preparing when build is enqueued' do - expect { build.enqueue_waiting_for_resource! }.to change { build.status }.from('waiting_for_resource').to('preparing') - end - end - - context 'when there are no available resources' do - before do - resource_group.assign_resource_to(create(:ci_build)) - end - - it 'stays as waiting for resource when build requests resource' do - expect { build.enqueue_waiting_for_resource }.not_to change { build.status } - end - end - end - end - end - describe '#on_stop' do subject { build.on_stop } |