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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
ad59f123
Commit
ad59f123
authored
Feb 04, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test both execute and async_execute
parent
1868b8af
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
21 deletions
+29
-21
spec/services/projects/destroy_service_spec.rb
spec/services/projects/destroy_service_spec.rb
+29
-21
No files found.
spec/services/projects/destroy_service_spec.rb
View file @
ad59f123
...
...
@@ -9,12 +9,27 @@ describe Projects::DestroyService, services: true do
shared_examples
'deleting the project'
do
it
'deletes the project'
do
expect
(
Project
.
all
).
not_to
include
(
project
)
expect
(
Project
.
unscoped
.
all
).
not_to
include
(
project
)
expect
(
Dir
.
exist?
(
path
)).
to
be_falsey
expect
(
Dir
.
exist?
(
remove_path
)).
to
be_falsey
end
end
shared_examples
'deleting the project with pipeline and build'
do
context
'with pipeline and build'
do
# which has optimistic locking
let!
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let!
(
:build
)
{
create
(
:ci_build
,
:artifacts
,
pipeline:
pipeline
)
}
before
do
perform_enqueued_jobs
do
destroy_project
(
project
,
user
,
{})
end
end
it_behaves_like
'deleting the project'
end
end
context
'Sidekiq inline'
do
before
do
# Run sidekiq immediatly to check that renamed repository will be removed
...
...
@@ -35,31 +50,24 @@ describe Projects::DestroyService, services: true do
it
{
expect
(
Dir
.
exist?
(
remove_path
)).
to
be_truthy
}
end
context
'
async delete of project with private issue visibility
'
do
let
!
(
:async
)
{
true
}
context
'
with async_execute
'
do
let
(
:async
)
{
true
}
before
do
project
.
project_feature
.
update_attribute
(
"issues_access_level"
,
ProjectFeature
::
PRIVATE
)
# Run sidekiq immediately to check that renamed repository will be removed
Sidekiq
::
Testing
.
inline!
{
destroy_project
(
project
,
user
,
{})
}
context
'async delete of project with private issue visibility'
do
before
do
project
.
project_feature
.
update_attribute
(
"issues_access_level"
,
ProjectFeature
::
PRIVATE
)
# Run sidekiq immediately to check that renamed repository will be removed
Sidekiq
::
Testing
.
inline!
{
destroy_project
(
project
,
user
,
{})
}
end
it_behaves_like
'deleting the project'
end
it_behaves_like
'deleting the project'
it_behaves_like
'deleting the project
with pipeline and build
'
end
context
'delete with pipeline and build'
do
# which has optimistic locking
let!
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let!
(
:build
)
{
create
(
:ci_build
,
:artifacts
,
pipeline:
pipeline
)
}
before
do
expect
(
project
).
to
receive
(
:destroy!
).
and_call_original
perform_enqueued_jobs
do
destroy_project
(
project
,
user
,
{})
end
end
it_behaves_like
'deleting the project'
context
'with execute'
do
it_behaves_like
'deleting the project with pipeline and build'
end
context
'container registry'
do
...
...
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