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
84276bb7
Commit
84276bb7
authored
Dec 04, 2019
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expire the caches of the design repository before rename
parent
02577fb6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
0 deletions
+41
-0
ee/app/models/ee/project.rb
ee/app/models/ee/project.rb
+11
-0
ee/spec/models/project_spec.rb
ee/spec/models/project_spec.rb
+25
-0
spec/models/project_spec.rb
spec/models/project_spec.rb
+5
-0
No files found.
ee/app/models/ee/project.rb
View file @
84276bb7
...
@@ -677,6 +677,17 @@ module EE
...
@@ -677,6 +677,17 @@ module EE
end
end
end
end
override
(
:expire_caches_before_rename
)
def
expire_caches_before_rename
(
old_path
)
super
design
=
::
Repository
.
new
(
"
#{
old_path
}#{
EE
::
Gitlab
::
GlRepository
::
DESIGN
.
path_suffix
}
"
,
self
)
if
design
.
exists?
design
.
before_delete
end
end
def
alerts_service_available?
def
alerts_service_available?
feature_available?
(
:incident_management
)
feature_available?
(
:incident_management
)
end
end
...
...
ee/spec/models/project_spec.rb
View file @
84276bb7
...
@@ -2383,4 +2383,29 @@ describe Project do
...
@@ -2383,4 +2383,29 @@ describe Project do
describe
'#license_compliance'
do
describe
'#license_compliance'
do
it
{
expect
(
subject
.
license_compliance
).
to
be_instance_of
(
::
SCA
::
LicenseCompliance
)
}
it
{
expect
(
subject
.
license_compliance
).
to
be_instance_of
(
::
SCA
::
LicenseCompliance
)
}
end
end
describe
'#expire_caches_before_rename'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:repo
)
{
double
(
:repo
,
exists?:
true
,
before_delete:
true
)
}
let
(
:wiki
)
{
double
(
:wiki
,
exists?:
true
,
before_delete:
true
)
}
let
(
:design
)
{
double
(
:design
,
exists?:
true
)
}
it
'expires the caches of the design repository'
do
allow
(
Repository
).
to
receive
(
:new
)
.
with
(
'foo'
,
project
)
.
and_return
(
repo
)
allow
(
Repository
).
to
receive
(
:new
)
.
with
(
'foo.wiki'
,
project
)
.
and_return
(
wiki
)
allow
(
Repository
).
to
receive
(
:new
)
.
with
(
'foo.design'
,
project
)
.
and_return
(
design
)
expect
(
design
).
to
receive
(
:before_delete
)
project
.
expire_caches_before_rename
(
'foo'
)
end
end
end
end
spec/models/project_spec.rb
View file @
84276bb7
...
@@ -1793,6 +1793,7 @@ describe Project do
...
@@ -1793,6 +1793,7 @@ describe Project do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:repo
)
{
double
(
:repo
,
exists?:
true
)
}
let
(
:repo
)
{
double
(
:repo
,
exists?:
true
)
}
let
(
:wiki
)
{
double
(
:wiki
,
exists?:
true
)
}
let
(
:wiki
)
{
double
(
:wiki
,
exists?:
true
)
}
let
(
:design
)
{
double
(
:wiki
,
exists?:
false
)
}
it
'expires the caches of the repository and wiki'
do
it
'expires the caches of the repository and wiki'
do
allow
(
Repository
).
to
receive
(
:new
)
allow
(
Repository
).
to
receive
(
:new
)
...
@@ -1803,6 +1804,10 @@ describe Project do
...
@@ -1803,6 +1804,10 @@ describe Project do
.
with
(
'foo.wiki'
,
project
)
.
with
(
'foo.wiki'
,
project
)
.
and_return
(
wiki
)
.
and_return
(
wiki
)
allow
(
Repository
).
to
receive
(
:new
)
.
with
(
'foo.design'
,
project
)
.
and_return
(
design
)
expect
(
repo
).
to
receive
(
:before_delete
)
expect
(
repo
).
to
receive
(
:before_delete
)
expect
(
wiki
).
to
receive
(
:before_delete
)
expect
(
wiki
).
to
receive
(
:before_delete
)
...
...
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