From 1cb89809eed287db5179bdf2c6cbc65e2a214d35 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 24 Apr 2019 15:50:45 +0000 Subject: [PATCH] Merge branch '54656-500-error-on-save-of-general-pipeline-settings-timeout' into 'master' Resolve "500 error on save of general pipeline settings timeout" Closes gitlab-ee#11281 See merge request gitlab-org/gitlab-ce!27416 (cherry picked from commit 23e5d9edcee5c0504bec9aade0e5abbb86ce06b1) 163730f0 Redirect to settings page on invalid update ef67a54a Add CHANGELOG entry --- app/controllers/projects/settings/ci_cd_controller.rb | 2 +- ...rror-on-save-of-general-pipeline-settings-timeout.yml | 5 +++++ .../projects/settings/ci_cd_controller_spec.rb | 9 +++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/54656-500-error-on-save-of-general-pipeline-settings-timeout.yml diff --git a/app/controllers/projects/settings/ci_cd_controller.rb b/app/controllers/projects/settings/ci_cd_controller.rb index d1c5cef76fa..c4dff95a4b9 100644 --- a/app/controllers/projects/settings/ci_cd_controller.rb +++ b/app/controllers/projects/settings/ci_cd_controller.rb @@ -19,7 +19,7 @@ module Projects redirect_to project_settings_ci_cd_path(@project) else - render 'show' + redirect_to project_settings_ci_cd_path(@project), alert: result[:message] end end end diff --git a/changelogs/unreleased/54656-500-error-on-save-of-general-pipeline-settings-timeout.yml b/changelogs/unreleased/54656-500-error-on-save-of-general-pipeline-settings-timeout.yml new file mode 100644 index 00000000000..8b4f4894048 --- /dev/null +++ b/changelogs/unreleased/54656-500-error-on-save-of-general-pipeline-settings-timeout.yml @@ -0,0 +1,5 @@ +--- +title: Fix 500 in general pipeline settings when passing an invalid build timeout. +merge_request: 27416 +author: +type: fixed diff --git a/spec/controllers/projects/settings/ci_cd_controller_spec.rb b/spec/controllers/projects/settings/ci_cd_controller_spec.rb index 41cc0607cee..1b5dcc6ff52 100644 --- a/spec/controllers/projects/settings/ci_cd_controller_spec.rb +++ b/spec/controllers/projects/settings/ci_cd_controller_spec.rb @@ -189,6 +189,15 @@ describe Projects::Settings::CiCdController do expect(project.build_timeout).to eq(5400) end end + + context 'when build_timeout_human_readable is invalid' do + let(:params) { { build_timeout_human_readable: '5m' } } + + it 'set specified timeout' do + expect(subject).to set_flash[:alert] + expect(response).to redirect_to(namespace_project_settings_ci_cd_path) + end + end end end end -- GitLab