Commit 7d7b0688 authored by Tomasz Maczukin's avatar Tomasz Maczukin

Add validation for max_timeout in Ci::Runner

parent c747d9bc
...@@ -54,6 +54,10 @@ module Ci ...@@ -54,6 +54,10 @@ module Ci
chronic_duration_attr :maximum_timeout_human_readable, :maximum_timeout chronic_duration_attr :maximum_timeout_human_readable, :maximum_timeout
validates :maximum_timeout, allow_nil: true,
numericality: { greater_than_or_equal_to: 600,
message: 'needs to be at least 10 minutes' }
# Searches for runners matching the given query. # Searches for runners matching the given query.
# #
# This method uses ILIKE on PostgreSQL and LIKE on MySQL. # This method uses ILIKE on PostgreSQL and LIKE on MySQL.
......
...@@ -1299,7 +1299,7 @@ describe Ci::Build do ...@@ -1299,7 +1299,7 @@ describe Ci::Build do
end end
context 'when runner sets timeout to smaller value' do context 'when runner sets timeout to smaller value' do
let(:runner2) { create(:ci_runner, maximum_timeout: 500) } let(:runner2) { create(:ci_runner, maximum_timeout: 600) }
let(:build) { create(:ci_build, :pending, pipeline: pipeline2, runner: runner2) } let(:build) { create(:ci_build, :pending, pipeline: pipeline2, runner: runner2) }
it 'returns project timeout configuration' do it 'returns project timeout configuration' 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