summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-07-18 15:28:20 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2017-07-24 08:54:56 +0200
commit7b2321d365bdefe18ce191c2b24fd44366fa837d (patch)
treeb856ac9755a7c68f741bdc6ea83ceeddd2d0768e
parent4e98ec7a6f44c7de13c1b9db4421bdc3eb0e607a (diff)
downloadgitlab-ce-7b2321d365bdefe18ce191c2b24fd44366fa837d.tar.gz
Take ee words into accountbvl-free-unused-names
We need to reserve these words in EE to support the upgrade path from CE to EE.
-rw-r--r--changelogs/unreleased/bvl-free-unused-names.yml5
-rw-r--r--spec/lib/gitlab/path_regex_spec.rb37
2 files changed, 28 insertions, 14 deletions
diff --git a/changelogs/unreleased/bvl-free-unused-names.yml b/changelogs/unreleased/bvl-free-unused-names.yml
new file mode 100644
index 00000000000..53acb95e5bb
--- /dev/null
+++ b/changelogs/unreleased/bvl-free-unused-names.yml
@@ -0,0 +1,5 @@
+---
+title: Free up some top level words, reject top level groups named like files in the
+ public folder
+merge_request: 12932
+author:
diff --git a/spec/lib/gitlab/path_regex_spec.rb b/spec/lib/gitlab/path_regex_spec.rb
index 37c67db8217..1adfaca1465 100644
--- a/spec/lib/gitlab/path_regex_spec.rb
+++ b/spec/lib/gitlab/path_regex_spec.rb
@@ -39,7 +39,9 @@ describe Gitlab::PathRegex, lib: true do
def failure_message(constant_name, migration_helper, missing_words:, additional_words: [])
missing_words = Array(missing_words)
additional_words = Array(additional_words)
- message = <<-MSG
+ message = ""
+ if missing_words.any?
+ message += <<-MISSING
Found new routes that could cause conflicts with existing namespaced routes
for groups or projects.
@@ -52,16 +54,15 @@ describe Gitlab::PathRegex, lib: true do
Make sure to make a note of the renamed records in the release blog post.
- MSG
+ MISSING
+ end
if additional_words.any?
- additional_message = <<-ADDITIONAL
+ message += <<-ADDITIONAL
Why are <#{additional_words.join(', ')}> in `#{constant_name}`?
If they are really required, update these specs to reflect that.
ADDITIONAL
-
- message = [message, additional_message].join
end
message
@@ -85,14 +86,11 @@ describe Gitlab::PathRegex, lib: true do
route.split('/')[1]
end.compact.uniq
- words += files_in_public
- words + additional_top_level_words
+ words + ee_top_level_words + files_in_public
end
- let(:additional_top_level_words) do
- # Required to keep the uploads safe, remove after
- # https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12917 gets merged
- ['system']
+ let(:ee_top_level_words) do
+ ['unsubscribes']
end
let(:files_in_public) do
@@ -145,7 +143,16 @@ describe Gitlab::PathRegex, lib: true do
let(:paths_after_group_id) do
group_routes.map do |route|
route.gsub(STARTING_WITH_GROUP, '').split('/').first
- end.uniq
+ end.uniq + ee_paths_after_group_id
+ end
+
+ let(:ee_paths_after_group_id) do
+ %w(analytics
+ ldap
+ ldap_group_links
+ notification_setting
+ audit_events
+ pipeline_quota hooks)
end
describe 'TOP_LEVEL_ROUTES' do
@@ -166,11 +173,13 @@ describe Gitlab::PathRegex, lib: true do
it "don't contain a second wildcard" do
failure_block = lambda do
missing_words = paths_after_group_id - described_class::GROUP_ROUTES
- failure_message('GROUP_ROUTES', 'rename_child_paths', missing_words: missing_words)
+ additional_words = described_class::GROUP_ROUTES - paths_after_group_id
+ failure_message('GROUP_ROUTES', 'rename_child_paths',
+ missing_words: missing_words, additional_words: additional_words)
end
expect(described_class::GROUP_ROUTES)
- .to include(*paths_after_group_id), failure_block
+ .to contain_exactly(*paths_after_group_id), failure_block
end
end