Commit eec76616 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Don't validate gitaly timeouts that didn't change

This avoids validating Gitaly timeouts, that could have become invalid
based on configuration in omnibus.

The invalid values would not be used, instead the mininum value from
omnibus would be used. But this would prevent the application settings
from being updated.

Skipping these validations makes sure the settings can still be saved
if unrelated values are changed.
parent eda4dc77
......@@ -172,6 +172,7 @@ class ApplicationSetting < ApplicationRecord
validates :gitaly_timeout_default,
presence: true,
if: :gitaly_timeout_default_changed?,
numericality: {
only_integer: true,
greater_than_or_equal_to: 0,
......@@ -180,6 +181,7 @@ class ApplicationSetting < ApplicationRecord
validates :gitaly_timeout_medium,
presence: true,
if: :gitaly_timeout_medium_changed?,
numericality: { only_integer: true, greater_than_or_equal_to: 0 }
validates :gitaly_timeout_medium,
numericality: { less_than_or_equal_to: :gitaly_timeout_default },
......@@ -190,6 +192,7 @@ class ApplicationSetting < ApplicationRecord
validates :gitaly_timeout_fast,
presence: true,
if: :gitaly_timeout_fast_changed?,
numericality: { only_integer: true, greater_than_or_equal_to: 0 }
validates :gitaly_timeout_fast,
numericality: { less_than_or_equal_to: :gitaly_timeout_default },
......
---
title: Fix saving preferences with unrelated changes when gitaly timeouts became invalid.
merge_request: 26292
author:
type: fixed
......@@ -380,6 +380,12 @@ describe ApplicationSetting do
expect(subject).to be_invalid
end
it 'does not prevent from saving when gitaly timeouts were previously invalid' do
subject.update_column(:gitaly_timeout_default, Settings.gitlab.max_request_duration_seconds + 1)
expect(subject.reload).to be_valid
end
end
describe 'enforcing terms' 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