Skip to content
Snippets Groups Projects
Commit 3760a7c2 authored by Bob Van Landuyt :neckbeard:'s avatar Bob Van Landuyt :neckbeard: :sunglasses:
Browse files

Only rename namespaces and projects with an invalid path

For exact matches, not namespaces that end with an invalid path
parent 61f811e6
No related branches found
No related tags found
2 merge requests!12073Add RC2 changes to 9-3-stable,!11338Only rename namespaces and projects with an invalid path
Pipeline #
Loading
Loading
@@ -15,7 +15,7 @@ module Gitlab
end
 
def path_patterns
@path_patterns ||= paths.map { |path| "%#{path}" }
@path_patterns ||= paths.map { |path| ["%/#{path}", "#{path}"] }.flatten
end
 
def rename_path_for_routable(routable)
Loading
Loading
Loading
Loading
@@ -23,6 +23,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces do
 
found_ids = subject.namespaces_for_paths(type: :child).
map(&:id)
expect(found_ids).to contain_exactly(child.id)
end
end
Loading
Loading
@@ -39,6 +40,22 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces do
 
found_ids = subject.namespaces_for_paths(type: :child).
map(&:id)
expect(found_ids).to contain_exactly(namespace.id)
end
it 'has no namespaces that look the same' do
_root_namespace = create(:namespace, path: 'THE-path')
_similar_path = create(:namespace,
path: 'not-really-the-path',
parent: create(:namespace))
namespace = create(:namespace,
path: 'the-path',
parent: create(:namespace))
found_ids = subject.namespaces_for_paths(type: :child).
map(&:id)
expect(found_ids).to contain_exactly(namespace.id)
end
end
Loading
Loading
@@ -53,6 +70,20 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces do
 
found_ids = subject.namespaces_for_paths(type: :top_level).
map(&:id)
expect(found_ids).to contain_exactly(root_namespace.id)
end
it 'has no namespaces that just look the same' do
root_namespace = create(:namespace, path: 'the-path')
_similar_path = create(:namespace, path: 'not-really-the-path')
_child_namespace = create(:namespace,
path: 'the-path',
parent: create(:namespace))
found_ids = subject.namespaces_for_paths(type: :top_level).
map(&:id)
expect(found_ids).to contain_exactly(root_namespace.id)
end
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment