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
baa00d54
Commit
baa00d54
authored
Apr 03, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor container registry repository tag stubs
parent
0af4cbc5
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
35 additions
and
17 deletions
+35
-17
repositories_controller_spec.rb
...rollers/projects/registry/repositories_controller_spec.rb
+4
-3
container_registry_spec.rb
spec/features/container_registry_spec.rb
+2
-1
internal_access_spec.rb
spec/features/security/project/internal_access_spec.rb
+1
-1
private_access_spec.rb
spec/features/security/project/private_access_spec.rb
+1
-1
public_access_spec.rb
spec/features/security/project/public_access_spec.rb
+1
-1
namespace_spec.rb
spec/models/namespace_spec.rb
+1
-1
project_spec.rb
spec/models/project_spec.rb
+1
-1
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
stub_gitlab_calls.rb
spec/support/stub_gitlab_calls.rb
+22
-6
No files found.
spec/controllers/projects/registry/repositories_controller_spec.rb
View file @
baa00d54
...
...
@@ -24,10 +24,11 @@ describe Projects::Registry::RepositoriesController do
end
end
context
'when root container repository
does not exist
'
do
context
'when root container repository
is not created
'
do
context
'when there are tags for this repository'
do
before
do
stub_container_registry_tags
(
%w[rc1 latest]
)
stub_container_registry_tags
(
repository:
project
.
full_path
,
tags:
%w[rc1 latest]
)
end
it
'successfully renders container repositories'
do
...
...
@@ -44,7 +45,7 @@ describe Projects::Registry::RepositoriesController do
context
'when there are no tags for this repository'
do
before
do
stub_container_registry_tags
(
*
[])
stub_container_registry_tags
(
repository: :any
,
tags:
[])
end
it
'successfully renders container repositories'
do
...
...
spec/features/container_registry_spec.rb
View file @
baa00d54
...
...
@@ -12,7 +12,7 @@ describe "Container Registry" do
login_as
(
user
)
project
.
add_developer
(
user
)
stub_container_registry_config
(
enabled:
true
)
stub_container_registry_tags
(
%w[latest
]
)
stub_container_registry_tags
(
repository: :any
,
tags:
[
])
end
context
'when there are no image repositories'
do
...
...
@@ -25,6 +25,7 @@ describe "Container Registry" do
context
'when there are image repositories'
do
before
do
stub_container_registry_tags
(
repository:
%r{my/image}
,
tags:
%w[latest]
)
project
.
container_repositories
<<
container_repository
end
...
...
spec/features/security/project/internal_access_spec.rb
View file @
baa00d54
...
...
@@ -446,7 +446,7 @@ describe "Internal Project Access", feature: true do
let
(
:container_repository
)
{
create
(
:container_repository
)
}
before
do
stub_container_registry_tags
(
'latest'
)
stub_container_registry_tags
(
repository: :any
,
tags:
[
'latest'
]
)
stub_container_registry_config
(
enabled:
true
)
project
.
container_repositories
<<
container_repository
end
...
...
spec/features/security/project/private_access_spec.rb
View file @
baa00d54
...
...
@@ -435,7 +435,7 @@ describe "Private Project Access", feature: true do
let
(
:container_repository
)
{
create
(
:container_repository
)
}
before
do
stub_container_registry_tags
(
'latest'
)
stub_container_registry_tags
(
repository: :any
,
tags:
[
'latest'
]
)
stub_container_registry_config
(
enabled:
true
)
project
.
container_repositories
<<
container_repository
end
...
...
spec/features/security/project/public_access_spec.rb
View file @
baa00d54
...
...
@@ -446,7 +446,7 @@ describe "Public Project Access", feature: true do
let
(
:container_repository
)
{
create
(
:container_repository
)
}
before
do
stub_container_registry_tags
(
'latest'
)
stub_container_registry_tags
(
repository: :any
,
tags
:[
'latest'
]
)
stub_container_registry_config
(
enabled:
true
)
project
.
container_repositories
<<
container_repository
end
...
...
spec/models/namespace_spec.rb
View file @
baa00d54
...
...
@@ -153,7 +153,7 @@ describe Namespace, models: true do
before
do
stub_container_registry_config
(
enabled:
true
)
stub_container_registry_tags
(
'tag'
)
stub_container_registry_tags
(
repository: :any
,
tags:
[
'tag'
]
)
create
(
:empty_project
,
namespace:
@namespace
,
container_repositories:
[
container_repository
])
...
...
spec/models/project_spec.rb
View file @
baa00d54
...
...
@@ -1190,7 +1190,7 @@ describe Project, models: true do
before
do
stub_container_registry_config
(
enabled:
true
)
stub_container_registry_tags
(
'tag'
)
stub_container_registry_tags
(
repository: :any
,
tags:
[
'tag'
]
)
project
.
container_repositories
<<
container_repository
end
...
...
spec/services/projects/destroy_service_spec.rb
View file @
baa00d54
...
...
@@ -94,7 +94,7 @@ describe Projects::DestroyService, services: true do
before
do
stub_container_registry_config
(
enabled:
true
)
stub_container_registry_tags
(
'tag'
)
stub_container_registry_tags
(
repository: :any
,
tags:
[
'tag'
]
)
project
.
container_repositories
<<
container_repository
end
...
...
spec/services/projects/transfer_service_spec.rb
View file @
baa00d54
...
...
@@ -33,7 +33,7 @@ describe Projects::TransferService, services: true do
before
do
stub_container_registry_config
(
enabled:
true
)
stub_container_registry_tags
(
'tag'
)
stub_container_registry_tags
(
repository: :any
,
tags:
[
'tag'
]
)
project
.
container_repositories
<<
container_repository
end
...
...
spec/support/stub_gitlab_calls.rb
View file @
baa00d54
...
...
@@ -31,20 +31,36 @@ module StubGitlabCalls
.
to
receive
(
:full_access_token
).
and_return
(
'token'
)
end
def
stub_container_registry_tags
(
*
tags
)
def
stub_container_registry_tags
(
repository: :any
,
tags
:)
repository
=
any_args
if
repository
==
:any
allow_any_instance_of
(
ContainerRegistry
::
Client
)
.
to
receive
(
:repository_tags
).
and_return
({
'tags'
=>
tags
})
.
to
receive
(
:repository_tags
).
with
(
repository
)
.
and_return
({
'tags'
=>
tags
})
allow_any_instance_of
(
ContainerRegistry
::
Client
)
.
to
receive
(
:repository_manifest
).
and_return
(
JSON
.
parse
(
File
.
read
(
Rails
.
root
+
'spec/fixtures/container_registry/tag_manifest.json'
))
)
.
to
receive
(
:repository_manifest
).
with
(
repository
)
.
and_return
(
stub_container_registry_tag_manifest
)
allow_any_instance_of
(
ContainerRegistry
::
Client
).
to
receive
(
:blob
).
and_return
(
File
.
read
(
Rails
.
root
+
'spec/fixtures/container_registry/config_blob.json'
))
allow_any_instance_of
(
ContainerRegistry
::
Client
)
.
to
receive
(
:blob
).
with
(
repository
)
.
and_return
(
stub_container_registry_blob
)
end
private
def
stub_container_registry_tag_manifest
fixture_path
=
'spec/fixtures/container_registry/tag_manifest.json'
JSON
.
parse
(
File
.
read
(
Rails
.
root
+
fixture_path
))
end
def
stub_container_registry_blob
fixture_path
=
'spec/fixtures/container_registry/config_blob.json'
File
.
read
(
Rails
.
root
+
fixture_path
)
end
def
gitlab_url
Gitlab
.
config
.
gitlab
.
url
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