Commit d96b0eac authored by Alex Lossent's avatar Alex Lossent

Allow to use same periods for housekeeping tasks

This enables skipping a lesser housekeeping task
(incremental or full repack) by consistently
scheduling a higher task (respectively full repack or gc)
with the same period.
Cf. #34981
parent 5cc140b2
......@@ -137,11 +137,11 @@ class ApplicationSetting < ActiveRecord::Base
validates :housekeeping_full_repack_period,
presence: true,
numericality: { only_integer: true, greater_than: :housekeeping_incremental_repack_period }
numericality: { only_integer: true, greater_than_or_equal_to: :housekeeping_incremental_repack_period }
validates :housekeeping_gc_period,
presence: true,
numericality: { only_integer: true, greater_than: :housekeeping_full_repack_period }
numericality: { only_integer: true, greater_than_or_equal_to: :housekeeping_full_repack_period }
validates :terminal_max_session_time,
presence: true,
......
---
title: Allow to use same periods for different housekeeping tasks (effectively
skipping the lesser task)
merge_request: 13711
author: @cernvcs
type: added
......@@ -167,19 +167,33 @@ describe ApplicationSetting do
context 'housekeeping settings' do
it { is_expected.not_to allow_value(0).for(:housekeeping_incremental_repack_period) }
it 'wants the full repack period to be longer than the incremental repack period' do
it 'wants the full repack period to be at least the incremental repack period' do
subject.housekeeping_incremental_repack_period = 2
subject.housekeeping_full_repack_period = 1
expect(subject).not_to be_valid
end
it 'wants the gc period to be longer than the full repack period' do
subject.housekeeping_full_repack_period = 2
subject.housekeeping_gc_period = 1
it 'wants the gc period to be at least the full repack period' do
subject.housekeeping_full_repack_period = 100
subject.housekeeping_gc_period = 90
expect(subject).not_to be_valid
end
it 'allows the same period for incremental repack and full repack, effectively skipping incremental repack' do
subject.housekeeping_incremental_repack_period = 2
subject.housekeeping_full_repack_period = 2
expect(subject).to be_valid
end
it 'allows the same period for full repack and gc, effectively skipping full repack' do
subject.housekeeping_full_repack_period = 100
subject.housekeeping_gc_period = 100
expect(subject).to be_valid
end
end
end
......
......@@ -75,7 +75,7 @@ describe Projects::HousekeepingService do
end
end
it 'uses all three kinds of housekeeping we offer' do
it 'goes through all three housekeeping tasks, executing only the highest task when there is overlap' do
allow(subject).to receive(:try_obtain_lease).and_return(:the_uuid)
allow(subject).to receive(:lease_key).and_return(:the_lease_key)
......
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