Update specs that use retryable canceled jobs

Specs that test canceled jobs now
- expect them not to be retryable or playable
- expect them not to show retry buttons

Specs that test retryability now
- use failed status instead of canceled status
This commit is contained in:
mfluharty 2019-04-19 13:19:59 -06:00
parent 2c2bd00a6c
commit 6b7b07b7ec
No known key found for this signature in database
GPG key ID: 6FDA03A308D239E8
5 changed files with 15 additions and 15 deletions

View file

@ -936,8 +936,8 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
find('.js-cancel-job').click
end
it 'loads the page and shows all needed controls' do
expect(page).to have_content 'Retry'
it 'loads the page and shows no controls' do
expect(page).not_to have_content 'Retry'
end
end
end
@ -946,7 +946,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
context "Job from project", :js do
before do
job.run!
job.cancel!
job.drop!(:script_failure)
visit project_job_path(project, job)
wait_for_requests

View file

@ -115,11 +115,11 @@ describe 'Pipeline', :js do
end
end
it 'cancels the running build and shows retry button' do
it 'cancels the running build and does not show retry button' do
find('#ci-badge-deploy .ci-action-icon-container').click
page.within('#ci-badge-deploy') do
expect(page).to have_css('.js-icon-retry')
expect(page).not_to have_css('.js-icon-retry')
end
end
end
@ -133,11 +133,11 @@ describe 'Pipeline', :js do
end
end
it 'cancels the preparing build and shows retry button' do
it 'cancels the preparing build and does not show retry button' do
find('#ci-badge-deploy .ci-action-icon-container').click
page.within('#ci-badge-deploy') do
expect(page).to have_css('.js-icon-retry')
expect(page).not_to have_css('.js-icon-retry')
end
end
end

View file

@ -163,11 +163,11 @@ describe Gitlab::Ci::Status::Build::Factory do
it 'matches correct extended statuses' do
expect(factory.extended_statuses)
.to eq [Gitlab::Ci::Status::Build::Canceled, Gitlab::Ci::Status::Build::Retryable]
.to eq [Gitlab::Ci::Status::Build::Canceled]
end
it 'fabricates a retryable build status' do
expect(status).to be_a Gitlab::Ci::Status::Build::Retryable
it 'does not fabricate a retryable build status' do
expect(status).not_to be_a Gitlab::Ci::Status::Build::Retryable
end
it 'fabricates status with correct details' do
@ -177,7 +177,7 @@ describe Gitlab::Ci::Status::Build::Factory do
expect(status.illustration).to include(:image, :size, :title)
expect(status.label).to eq 'canceled'
expect(status).to have_details
expect(status).to have_action
expect(status).not_to have_action
end
end

View file

@ -1425,7 +1425,7 @@ describe Ci::Build do
build.cancel!
end
it { is_expected.to be_retryable }
it { is_expected.not_to be_retryable }
end
end
@ -1955,7 +1955,7 @@ describe Ci::Build do
context 'when build has been canceled' do
subject { build_stubbed(:ci_build, :manual, status: :canceled) }
it { is_expected.to be_playable }
it { is_expected.not_to be_playable }
end
context 'when build is successful' do

View file

@ -863,7 +863,7 @@ describe API::Jobs do
end
describe 'POST /projects/:id/jobs/:job_id/retry' do
let(:job) { create(:ci_build, :canceled, pipeline: pipeline) }
let(:job) { create(:ci_build, :failed, pipeline: pipeline) }
before do
post api("/projects/#{project.id}/jobs/#{job.id}/retry", api_user)
@ -873,7 +873,7 @@ describe API::Jobs do
context 'user with :update_build permission' do
it 'retries non-running job' do
expect(response).to have_gitlab_http_status(201)
expect(project.builds.first.status).to eq('canceled')
expect(project.builds.first.status).to eq('failed')
expect(json_response['status']).to eq('pending')
end
end