summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-09-12 12:20:40 +0000
committerDouwe Maan <douwe@gitlab.com>2017-09-12 12:20:40 +0000
commit91e90ae78b1a47a5add859cbffcca0de5a7deef5 (patch)
treeef4eeb979a9a9edee4372309d6d900257d0b748a
parenteaabcb1fc673e9818d834b333832aad2b1f5edac (diff)
parentd96b0eac0303278d4f215770533d09a2aec7955b (diff)
downloadgitlab-ce-91e90ae78b1a47a5add859cbffcca0de5a7deef5.tar.gz
Merge branch 'housekeeping_settings' into 'master'
Allow to use same periods for housekeeping tasks Closes #34981 See merge request !13711
-rw-r--r--app/models/application_setting.rb4
-rw-r--r--changelogs/unreleased/13711-allow-same-period-housekeeping.yml6
-rw-r--r--spec/models/application_setting_spec.rb22
-rw-r--r--spec/services/projects/housekeeping_service_spec.rb2
4 files changed, 27 insertions, 7 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index aede9b5f9da..c0cc60d5ebf 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -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,
diff --git a/changelogs/unreleased/13711-allow-same-period-housekeeping.yml b/changelogs/unreleased/13711-allow-same-period-housekeeping.yml
new file mode 100644
index 00000000000..6749e22cf6a
--- /dev/null
+++ b/changelogs/unreleased/13711-allow-same-period-housekeeping.yml
@@ -0,0 +1,6 @@
+---
+title: Allow to use same periods for different housekeeping tasks (effectively
+ skipping the lesser task)
+merge_request: 13711
+author: @cernvcs
+type: added
diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb
index c7a9eabdf06..78cacf9ff5d 100644
--- a/spec/models/application_setting_spec.rb
+++ b/spec/models/application_setting_spec.rb
@@ -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
diff --git a/spec/services/projects/housekeeping_service_spec.rb b/spec/services/projects/housekeeping_service_spec.rb
index 437c009e7fa..b7b5de07380 100644
--- a/spec/services/projects/housekeeping_service_spec.rb
+++ b/spec/services/projects/housekeeping_service_spec.rb
@@ -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)