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
f49a6fed
Commit
f49a6fed
authored
Jun 30, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Log renamed event to the Geo event log when namespace is renamed
parent
744cb678
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
0 deletions
+46
-0
app/models/ee/namespace.rb
app/models/ee/namespace.rb
+17
-0
app/models/namespace.rb
app/models/namespace.rb
+1
-0
spec/models/ee/namespace_spec.rb
spec/models/ee/namespace_spec.rb
+28
-0
No files found.
app/models/ee/namespace.rb
View file @
f49a6fed
...
...
@@ -29,6 +29,23 @@ module EE
validates
:plan
,
inclusion:
{
in:
EE_PLANS
.
keys
},
allow_blank:
true
end
def
move_dir
raise
NotImplementedError
unless
defined?
(
super
)
succeeded
=
super
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
).
create
end
end
succeeded
end
# Checks features (i.e. https://about.gitlab.com/products/) availabily
# for a given Namespace plan. This method should consider ancestor groups
# being licensed.
...
...
app/models/namespace.rb
View file @
f49a6fed
...
...
@@ -144,6 +144,7 @@ class Namespace < ActiveRecord::Base
# So we basically we mute exceptions in next actions
begin
send_update_instructions
true
rescue
# Returning false does not rollback after_* transaction but gives
# us information about failing some of tasks
...
...
spec/models/ee/namespace_spec.rb
View file @
f49a6fed
...
...
@@ -42,6 +42,34 @@ describe Namespace, models: true do
end
end
describe
'#move_dir'
do
context
'when running on a primary node'
do
let!
(
:geo_node
)
{
create
(
:geo_node
,
:primary
,
:current
)
}
let
(
:gitlab_shell
)
{
Gitlab
::
Shell
.
new
}
it
'logs the Geo::RepositoryRenamedEvent for each project inside namespace'
do
parent
=
create
(
:namespace
)
child
=
create
(
:group
,
name:
'child'
,
path:
'child'
,
parent:
parent
)
project_1
=
create
(
:project_empty_repo
,
namespace:
parent
)
project_2
=
create
(
:project_empty_repo
,
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
)
allow
(
gitlab_shell
).
to
receive
(
:mv_namespace
)
.
ordered
.
with
(
project_1
.
repository_storage_path
,
full_path_was
,
new_path
)
.
and_return
(
true
)
expect
{
parent
.
move_dir
}.
to
change
(
Geo
::
RepositoryRenamedEvent
,
:count
).
by
(
2
)
end
end
end
describe
'#feature_available?'
do
let
(
:plan_license
)
{
Namespace
::
BRONZE_PLAN
}
let
(
:group
)
{
create
(
:group
,
plan:
plan_license
)
}
...
...
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