Commit c0f0052c authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch '55329-fix-container_expiration_policy-import' into 'master'

Fix :container_expiration_policy Import

See merge request gitlab-org/gitlab!21753
parents 1578bae2 e6cb8f9e
...@@ -38,12 +38,12 @@ module Gitlab ...@@ -38,12 +38,12 @@ module Gitlab
IMPORTED_OBJECT_MAX_RETRIES = 5.freeze IMPORTED_OBJECT_MAX_RETRIES = 5.freeze
EXISTING_OBJECT_CHECK = %i[milestone milestones label labels project_label project_labels group_label group_labels project_feature merge_request ProjectCiCdSetting].freeze EXISTING_OBJECT_CHECK = %i[milestone milestones label labels project_label project_labels group_label group_labels project_feature merge_request ProjectCiCdSetting container_expiration_policy].freeze
TOKEN_RESET_MODELS = %i[Project Namespace Ci::Trigger Ci::Build Ci::Runner ProjectHook].freeze TOKEN_RESET_MODELS = %i[Project Namespace Ci::Trigger Ci::Build Ci::Runner ProjectHook].freeze
# This represents all relations that have unique key on `project_id` # This represents all relations that have unique key on `project_id`
UNIQUE_RELATIONS = %i[project_feature ProjectCiCdSetting].freeze UNIQUE_RELATIONS = %i[project_feature ProjectCiCdSetting container_expiration_policy].freeze
def self.create(*args) def self.create(*args)
new(*args).create new(*args).create
......
...@@ -6757,6 +6757,17 @@ ...@@ -6757,6 +6757,17 @@
"updated_at": "2017-01-16T15:25:29.637Z" "updated_at": "2017-01-16T15:25:29.637Z"
} }
], ],
"container_expiration_policy": {
"created_at": "2019-12-13 13:45:04 UTC",
"updated_at": "2019-12-13 13:45:04 UTC",
"next_run_at": null,
"project_id": 5,
"name_regex": null,
"cadence": "3month",
"older_than": null,
"keep_n": 100,
"enabled": false
},
"deploy_keys": [], "deploy_keys": [],
"services": [ "services": [
{ {
......
...@@ -240,6 +240,16 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do ...@@ -240,6 +240,16 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
expect(sentry_issue.sentry_issue_identifier).to eq(1234567891) expect(sentry_issue.sentry_issue_identifier).to eq(1234567891)
end end
it 'restores container_expiration_policy' do
policy = Project.find_by_path('project').container_expiration_policy
aggregate_failures do
expect(policy).to be_an_instance_of(ContainerExpirationPolicy)
expect(policy).to be_persisted
expect(policy.cadence).to eq('3month')
end
end
context 'Merge requests' do context 'Merge requests' do
it 'always has the new project as a target' do it 'always has the new project as a target' do
expect(MergeRequest.find_by_title('MR1').target_project).to eq(@project) expect(MergeRequest.find_by_title('MR1').target_project).to eq(@project)
......
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