BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
7db1f226
Commit
7db1f226
authored
Mar 24, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix specs for services related to container registry
parent
af42dd29
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
15 deletions
+23
-15
destroy_service_spec.rb
spec/services/container_images/destroy_service_spec.rb
+21
-13
destroy_service_spec.rb
spec/services/projects/destroy_service_spec.rb
+1
-1
transfer_service_spec.rb
spec/services/projects/transfer_service_spec.rb
+1
-1
No files found.
spec/services/container_images/destroy_service_spec.rb
View file @
7db1f226
require
'spec_helper'
require
'spec_helper'
describe
ContainerImages
::
DestroyService
,
services:
true
do
describe
ContainerImages
::
DestroyService
,
'#execute'
,
:services
do
describe
'#execute'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:container_repository
)
{
create
(
:container_repository
,
name:
''
)
}
let
(
:project
)
{
create
(
:project
,
path:
'test'
,
namespace:
user
.
namespace
,
container_repositorys:
[
container_repository
])
}
let
(
:container_repository
)
do
let
(
:example_host
)
{
'example.com'
}
create
(
:container_repository
,
name:
'myimage'
,
tags:
%w[latest]
)
let
(
:registry_url
)
{
'http://'
+
example_host
}
end
let
(
:project
)
do
create
(
:project
,
path:
'test'
,
namespace:
user
.
namespace
,
container_repositories:
[
container_repository
])
end
it
{
expect
(
container_repository
).
to
be_valid
}
it
{
expect
(
container_repository
).
to
be_valid
}
it
{
expect
(
project
.
container_repository
s
).
not_to
be_empty
}
it
{
expect
(
project
.
container_repositorie
s
).
not_to
be_empty
}
context
'when container image has tags'
do
context
'when container image has tags'
do
before
do
before
do
project
.
team
<<
[
user
,
:master
]
project
.
add_master
(
user
)
end
end
it
'removes all tags before destroy'
do
it
'removes all tags before destroy'
do
service
=
described_class
.
new
(
project
,
user
)
service
=
described_class
.
new
(
project
,
user
)
expect
(
container_repository
).
to
receive
(
:delete_tags
).
and_return
(
true
)
expect
(
container_repository
)
expect
{
service
.
execute
(
container_repository
)
}.
to
change
(
project
.
container_repositorys
,
:count
).
by
(
-
1
)
.
to
receive
(
:delete_tags
).
and_return
(
true
)
expect
{
service
.
execute
(
container_repository
)
}
.
to
change
(
project
.
container_repositories
,
:count
).
by
(
-
1
)
end
end
it
'fails when tags are not removed'
do
it
'fails when tags are not removed'
do
service
=
described_class
.
new
(
project
,
user
)
service
=
described_class
.
new
(
project
,
user
)
expect
(
container_repository
).
to
receive
(
:delete_tags
).
and_return
(
false
)
expect
(
container_repository
)
expect
{
service
.
execute
(
container_repository
)
}.
to
raise_error
(
ActiveRecord
::
RecordNotDestroyed
)
.
to
receive
(
:delete_tags
).
and_return
(
false
)
end
expect
{
service
.
execute
(
container_repository
)
}
.
to
raise_error
(
ActiveRecord
::
RecordNotDestroyed
)
end
end
end
end
end
end
spec/services/projects/destroy_service_spec.rb
View file @
7db1f226
...
@@ -95,7 +95,7 @@ describe Projects::DestroyService, services: true do
...
@@ -95,7 +95,7 @@ describe Projects::DestroyService, services: true do
before
do
before
do
stub_container_registry_config
(
enabled:
true
)
stub_container_registry_config
(
enabled:
true
)
stub_container_registry_tags
(
'tag'
)
stub_container_registry_tags
(
'tag'
)
project
.
container_repositor
y
s
<<
container_repository
project
.
container_repositor
ie
s
<<
container_repository
end
end
context
'images deletion succeeds'
do
context
'images deletion succeeds'
do
...
...
spec/services/projects/transfer_service_spec.rb
View file @
7db1f226
...
@@ -34,7 +34,7 @@ describe Projects::TransferService, services: true do
...
@@ -34,7 +34,7 @@ describe Projects::TransferService, services: true do
before
do
before
do
stub_container_registry_config
(
enabled:
true
)
stub_container_registry_config
(
enabled:
true
)
stub_container_registry_tags
(
'tag'
)
stub_container_registry_tags
(
'tag'
)
project
.
container_repositor
y
s
<<
container_repository
project
.
container_repositor
ie
s
<<
container_repository
end
end
subject
{
transfer_project
(
project
,
user
,
group
)
}
subject
{
transfer_project
(
project
,
user
,
group
)
}
...
...
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