summaryrefslogtreecommitdiff
path: root/spec/features/projects/jobs_spec.rb
diff options
context:
space:
mode:
authorSteve Azzopardi <steveazz@outlook.com>2018-10-18 09:36:24 +0200
committerFilipa Lacerda <filipa@gitlab.com>2018-11-02 10:03:41 +0000
commit6d49e882d9f5ab5d397e15221f299c979e030b09 (patch)
tree10d57c37623e0037fedee55f1a6043693f782c9a /spec/features/projects/jobs_spec.rb
parent6ebbd70fbb3bfbda9745ad16ec1cd26ad41366c5 (diff)
downloadgitlab-ce-6d49e882d9f5ab5d397e15221f299c979e030b09.tar.gz
Frontend currently defines when a job is stuck, which we already have in the backend, expose `stuck` field in the `Project::JobsController#show.json` so the duplication of the logic is removed. Use `stuck` flag from API Removes isJobStuck check from frontend and uses the flag being provided by the API Renders missing tags message Moves available runners check into a computed prop Fix changelog for stuck job
Diffstat (limited to 'spec/features/projects/jobs_spec.rb')
-rw-r--r--spec/features/projects/jobs_spec.rb56
1 files changed, 56 insertions, 0 deletions
diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb
index a3a301504ff..24520d0aecb 100644
--- a/spec/features/projects/jobs_spec.rb
+++ b/spec/features/projects/jobs_spec.rb
@@ -738,6 +738,62 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
expect(page).not_to have_css('.js-build-sidebar.right-sidebar-collpased')
end
end
+
+ context 'stuck', :js do
+ before do
+ visit project_job_path(project, job)
+ wait_for_requests
+ end
+
+ context 'without active runners available' do
+ let(:runner) { create(:ci_runner, :instance, active: false) }
+ let(:job) { create(:ci_build, :pending, pipeline: pipeline, runner: runner) }
+
+ it 'renders message about job being stuck because no runners are active' do
+ expect(page).to have_css('.js-stuck-no-active-runner')
+ expect(page).to have_content("This job is stuck, because you don't have any active runners that can run this job.")
+ end
+ end
+
+ context 'when available runners can not run specified tag' do
+ let(:runner) { create(:ci_runner, :instance, active: false) }
+ let(:job) { create(:ci_build, :pending, pipeline: pipeline, runner: runner, tag_list: %w(docker linux)) }
+
+ it 'renders message about job being stuck because of no runners with the specified tags' do
+ expect(page).to have_css('.js-stuck-with-tags')
+ expect(page).to have_content("This job is stuck, because you don't have any active runners online with any of these tags assigned to them:")
+ end
+ end
+
+ context 'when runners are offline and build has tags' do
+ let(:runner) { create(:ci_runner, :instance, active: true) }
+ let(:job) { create(:ci_build, :pending, pipeline: pipeline, runner: runner, tag_list: %w(docker linux)) }
+
+ it 'renders message about job being stuck because of no runners with the specified tags' do
+ expect(page).to have_css('.js-stuck-with-tags')
+ expect(page).to have_content("This job is stuck, because you don't have any active runners online with any of these tags assigned to them:")
+ end
+ end
+
+ context 'without any runners available' do
+ let(:job) { create(:ci_build, :pending, pipeline: pipeline) }
+
+ it 'renders message about job being stuck because not runners are available' do
+ expect(page).to have_css('.js-stuck-no-active-runner')
+ expect(page).to have_content("This job is stuck, because you don't have any active runners that can run this job.")
+ end
+ end
+
+ context 'without available runners online' do
+ let(:runner) { create(:ci_runner, :instance, active: true) }
+ let(:job) { create(:ci_build, :pending, pipeline: pipeline, runner: runner) }
+
+ it 'renders message about job being stuck because runners are offline' do
+ expect(page).to have_css('.js-stuck-no-runners')
+ expect(page).to have_content("This job is stuck, because the project doesn't have any runners online assigned to it.")
+ end
+ end
+ end
end
describe "POST /:project/jobs/:id/cancel", :js do