Commit 6ad0c9e0 authored by Shinya Maeda's avatar Shinya Maeda

Make jobs with resource group cancellable

parent 7809db0c
...@@ -7,7 +7,7 @@ module HasStatus ...@@ -7,7 +7,7 @@ module HasStatus
BLOCKED_STATUS = %w[manual scheduled].freeze BLOCKED_STATUS = %w[manual scheduled].freeze
AVAILABLE_STATUSES = %w[created waiting_for_resource preparing pending running success failed canceled skipped manual scheduled].freeze AVAILABLE_STATUSES = %w[created waiting_for_resource preparing pending running success failed canceled skipped manual scheduled].freeze
STARTED_STATUSES = %w[running success failed skipped manual scheduled].freeze STARTED_STATUSES = %w[running success failed skipped manual scheduled].freeze
ACTIVE_STATUSES = %w[preparing pending running].freeze ACTIVE_STATUSES = %w[waiting_for_resource preparing pending running].freeze
COMPLETED_STATUSES = %w[success failed canceled skipped].freeze COMPLETED_STATUSES = %w[success failed canceled skipped].freeze
ORDERED_STATUSES = %w[failed preparing pending running waiting_for_resource manual scheduled canceled success skipped created].freeze ORDERED_STATUSES = %w[failed preparing pending running waiting_for_resource manual scheduled canceled success skipped created].freeze
PASSED_WITH_WARNINGS_STATUSES = %w[failed canceled].to_set.freeze PASSED_WITH_WARNINGS_STATUSES = %w[failed canceled].to_set.freeze
......
---
title: Make jobs with resource group cancellable
merge_request: 22356
author:
type: fixed
...@@ -306,6 +306,21 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do ...@@ -306,6 +306,21 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
end end
end end
context 'when job is waiting for resource', :js do
let(:job) { create(:ci_build, :waiting_for_resource, pipeline: pipeline, resource_group: resource_group) }
let(:resource_group) { create(:ci_resource_group, project: project) }
before do
visit project_job_path(project, job)
wait_for_requests
end
it 'shows correct UI components' do
expect(page).to have_content("This job is waiting for resource: #{resource_group.key}")
expect(page).to have_link("Cancel this job")
end
end
context "Job from other project" do context "Job from other project" do
before do before do
visit project_job_path(project, job2) visit project_job_path(project, job2)
......
...@@ -1610,6 +1610,12 @@ describe Ci::Build do ...@@ -1610,6 +1610,12 @@ describe Ci::Build do
it { is_expected.to be_cancelable } it { is_expected.to be_cancelable }
end end
context 'when build is waiting for resource' do
let(:build) { create(:ci_build, :waiting_for_resource) }
it { is_expected.to be_cancelable }
end
end end
context 'when build is not cancelable' do context 'when build is not cancelable' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment