Skip to content
代码片段 群组 项目
未验证 提交 47234fbb 编辑于 作者: Rodrigo Tomonari's avatar Rodrigo Tomonari 提交者: GitLab
浏览文件

Merge branch...

Merge branch '508115-validate-one-org-group-project-is-present-in-bulk-import-entity' into 'master' 

Remove redundant validate in BulkImport::Entity

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/182760



Merged-by: default avatarRodrigo Tomonari <rtomonari@gitlab.com>
Approved-by: default avatarGeorge Koltsov <gkoltsov@gitlab.com>
Approved-by: default avatarRodrigo Tomonari <rtomonari@gitlab.com>
Reviewed-by: default avatarJannik Lehmann <jlehmann@gitlab.com>
Co-authored-by: default avatarlong nguyen huy <n.h.long.9697@gmail.com>
No related branches found
No related tags found
2 合并请求!3031Merge per-main-jh to main-jh by luzhiyuan,!3030Merge per-main-jh to main-jh
......@@ -41,16 +41,13 @@ class BulkImports::Entity < ApplicationRecord
inverse_of: :entity,
foreign_key: :bulk_import_entity_id
validates :project, absence: true, if: :group
validates :group, absence: true, if: :project
validates :source_type, presence: true
validates :source_full_path, presence: true
validates :destination_name, presence: true, if: -> { group || project }
validates :destination_namespace, exclusion: [nil], if: :group
validates :destination_namespace, presence: true, if: :project?
# TODO: Remove `on: :create` once the post migration SetOrganizationIdForBulkImportEntities has run
validate :validate_only_one_sharding_key_present, on: :create
validate :validate_only_one_sharding_key_present
validate :validate_parent_is_a_group, if: :parent
validate :validate_imported_entity_type
validate :validate_destination_namespace_ascendency, if: :group_entity?
......
......@@ -43,7 +43,9 @@
entity = build(:bulk_import_entity, group: build(:group), project: build(:project))
expect(entity).not_to be_valid
expect(entity.errors).to include(:base, :project, :group)
expect(entity.errors[:base])
.to include('Import failed: Must have exactly one of organization, group or project.')
end
end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册