Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/factories/packages/cleanup/policies.rb')
-rw-r--r--spec/factories/packages/cleanup/policies.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/factories/packages/cleanup/policies.rb b/spec/factories/packages/cleanup/policies.rb
new file mode 100644
index 00000000000..80baa2f78bd
--- /dev/null
+++ b/spec/factories/packages/cleanup/policies.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+FactoryBot.define do
+ factory :packages_cleanup_policy, class: 'Packages::Cleanup::Policy' do
+ project
+
+ keep_n_duplicated_package_files { '10' }
+
+ trait :runnable do
+ after(:create) do |policy|
+ # next_run_at will be set before_save to Time.now + cadence, so this ensures the policy is active
+ policy.update_column(:next_run_at, Time.zone.now - 1.day)
+ end
+ end
+ end
+end