Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e91b1a1d
Commit
e91b1a1d
authored
May 14, 2018
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix old_path_with_namespace
when the namespace has subgroups with projects.
parent
8ba91334
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
18 deletions
+40
-18
ee/app/models/ee/namespace.rb
ee/app/models/ee/namespace.rb
+5
-3
ee/changelogs/unreleased/mk-geo-fix-renaming-namespace-with-subgroup.yml
...nreleased/mk-geo-fix-renaming-namespace-with-subgroup.yml
+5
-0
ee/spec/models/namespace_spec.rb
ee/spec/models/namespace_spec.rb
+30
-15
No files found.
ee/app/models/ee/namespace.rb
View file @
e91b1a1d
...
...
@@ -51,12 +51,10 @@ module EE
if
succeeded
all_projects
.
each
do
|
project
|
old_path_with_namespace
=
File
.
join
(
full_path_was
,
project
.
path
)
::
Geo
::
RepositoryRenamedEventStore
.
new
(
project
,
old_path:
project
.
path
,
old_path_with_namespace:
old_path_with_namespace
old_path_with_namespace:
old_path_with_namespace
_for
(
project
)
).
create
end
end
...
...
@@ -64,6 +62,10 @@ module EE
succeeded
end
def
old_path_with_namespace_for
(
project
)
project
.
full_path
.
sub
(
/\A
#{
Regexp
.
escape
(
full_path
)
}
/
,
full_path_was
)
end
# Checks features (i.e. https://about.gitlab.com/products/) availabily
# for a given Namespace plan. This method should consider ancestor groups
# being licensed.
...
...
ee/changelogs/unreleased/mk-geo-fix-renaming-namespace-with-subgroup.yml
0 → 100644
View file @
e91b1a1d
---
title
:
'
Geo:
Fix
repo,
wiki,
and
upload
replication
when
renaming
a
namespace
that
has
subgroups'
merge_request
:
5704
author
:
type
:
fixed
ee/spec/models/namespace_spec.rb
View file @
e91b1a1d
...
...
@@ -98,26 +98,41 @@ describe Namespace do
set
(
:primary
)
{
create
(
:geo_node
,
:primary
)
}
set
(
:secondary
)
{
create
(
:geo_node
)
}
let
(
:gitlab_shell
)
{
Gitlab
::
Shell
.
new
}
let
(
:parent_group
)
{
create
(
:group
)
}
let
(
:child_group
)
{
create
(
:group
,
name:
'child'
,
path:
'child'
,
parent:
parent_group
)
}
let!
(
:project_legacy
)
{
create
(
:project_empty_repo
,
:legacy_storage
,
namespace:
parent_group
)
}
let!
(
:project_child_hashed
)
{
create
(
:project
,
namespace:
child_group
)
}
let!
(
:project_child_legacy
)
{
create
(
:project_empty_repo
,
:legacy_storage
,
namespace:
child_group
)
}
let!
(
:full_path_was
)
{
"
#{
parent_group
.
full_path
}
_old"
}
it
'logs the Geo::RepositoryRenamedEvent for each project inside namespace'
do
parent
=
create
(
:namespace
)
child
=
create
(
:group
,
name:
'child'
,
path:
'child'
,
parent:
parent
)
project_legacy_storage
=
create
(
:project_empty_repo
,
:legacy_storage
,
namespace:
parent
)
create
(
:project
,
namespace:
child
)
create
(
:project_empty_repo
,
:legacy_storage
,
namespace:
child
)
full_path_was
=
"
#{
parent
.
full_path
}
_old"
new_path
=
parent
.
full_path
allow
(
parent
).
to
receive
(
:gitlab_shell
).
and_return
(
gitlab_shell
)
allow
(
parent
).
to
receive
(
:path_changed?
).
and_return
(
true
)
allow
(
parent
).
to
receive
(
:full_path_was
).
and_return
(
full_path_was
)
allow
(
parent
).
to
receive
(
:full_path
).
and_return
(
new_path
)
before
do
new_path
=
parent_group
.
full_path
allow
(
parent_group
).
to
receive
(
:gitlab_shell
).
and_return
(
gitlab_shell
)
allow
(
parent_group
).
to
receive
(
:path_changed?
).
and_return
(
true
)
allow
(
parent_group
).
to
receive
(
:full_path_was
).
and_return
(
full_path_was
)
allow
(
parent_group
).
to
receive
(
:full_path
).
and_return
(
new_path
)
allow
(
gitlab_shell
).
to
receive
(
:mv_namespace
)
.
with
(
project_legacy
_storage
.
repository_storage
,
full_path_was
,
new_path
)
.
with
(
project_legacy
.
repository_storage
,
full_path_was
,
new_path
)
.
and_return
(
true
)
end
it
'logs the Geo::RepositoryRenamedEvent for each project inside namespace'
do
expect
{
parent_group
.
move_dir
}.
to
change
(
Geo
::
RepositoryRenamedEvent
,
:count
).
by
(
3
)
end
it
'properly builds old_path_with_namespace'
do
parent_group
.
move_dir
actual
=
Geo
::
RepositoryRenamedEvent
.
last
(
3
).
map
(
&
:old_path_with_namespace
)
expected
=
%W[
#{
full_path_was
}
/
#{
project_legacy
.
path
}
#{
full_path_was
}
/child/
#{
project_child_hashed
.
path
}
#{
full_path_was
}
/child/
#{
project_child_legacy
.
path
}
]
expect
{
parent
.
move_dir
}.
to
change
(
Geo
::
RepositoryRenamedEvent
,
:count
).
by
(
3
)
expect
(
actual
).
to
match_array
(
expected
)
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment