Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
873a8af4
Commit
873a8af4
authored
Mar 23, 2016
by
Jack Greenfield
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #439 from jackgr/manager
First round of refactoring for Manager
parents
5a058775
18068bdc
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
25 additions
and
16 deletions
+25
-16
frobnitz-0.0.1.tgz
pkg/chart/testdata/frobnitz-0.0.1.tgz
+0
-0
gcs_repo_test.go
pkg/repo/gcs_repo_test.go
+1
-1
inmem_repo_service.go
pkg/repo/inmem_repo_service.go
+3
-3
inmem_repo_service_test.go
pkg/repo/inmem_repo_service_test.go
+5
-1
repoprovider.go
pkg/repo/repoprovider.go
+12
-7
repoprovider_test.go
pkg/repo/repoprovider_test.go
+3
-3
types.go
pkg/repo/types.go
+1
-1
No files found.
pkg/chart/testdata/frobnitz-0.0.1.tgz
View file @
873a8af4
No preview for this file type
pkg/repo/gcs_repo_test.go
View file @
873a8af4
...
@@ -112,7 +112,7 @@ func TestGetChart(t *testing.T) {
...
@@ -112,7 +112,7 @@ func TestGetChart(t *testing.T) {
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
if
reflect
.
DeepEqual
(
wantFile
,
haveFile
)
{
if
!
reflect
.
DeepEqual
(
wantFile
,
haveFile
)
{
t
.
Fatalf
(
"retrieved invalid chart
\n
want:%#v
\n
have:
\n
%#v
\n
"
,
wantFile
,
haveFile
)
t
.
Fatalf
(
"retrieved invalid chart
\n
want:%#v
\n
have:
\n
%#v
\n
"
,
wantFile
,
haveFile
)
}
}
}
}
...
...
pkg/repo/inmem_repo_service.go
View file @
873a8af4
...
@@ -42,13 +42,13 @@ func NewInmemRepoService() IRepoService {
...
@@ -42,13 +42,13 @@ func NewInmemRepoService() IRepoService {
}
}
// List returns the list of all known chart repositories
// List returns the list of all known chart repositories
func
(
rs
*
inmemRepoService
)
List
()
([]
IRepo
,
error
)
{
func
(
rs
*
inmemRepoService
)
List
()
([]
string
,
error
)
{
rs
.
RLock
()
rs
.
RLock
()
defer
rs
.
RUnlock
()
defer
rs
.
RUnlock
()
ret
:=
[]
IRepo
{}
ret
:=
[]
string
{}
for
_
,
r
:=
range
rs
.
repositories
{
for
_
,
r
:=
range
rs
.
repositories
{
ret
=
append
(
ret
,
r
)
ret
=
append
(
ret
,
r
.
GetName
()
)
}
}
return
ret
,
nil
return
ret
,
nil
...
...
pkg/repo/inmem_repo_service_test.go
View file @
873a8af4
...
@@ -32,7 +32,11 @@ func TestService(t *testing.T) {
...
@@ -32,7 +32,11 @@ func TestService(t *testing.T) {
t
.
Fatalf
(
"unexpected repo count; want: %d, have %d."
,
1
,
len
(
repos
))
t
.
Fatalf
(
"unexpected repo count; want: %d, have %d."
,
1
,
len
(
repos
))
}
}
tr
:=
repos
[
0
]
tr
,
err
:=
rs
.
Get
(
repos
[
0
])
if
err
!=
nil
{
t
.
Fatalf
(
"cannot get repo named %s: %s"
,
repos
[
0
],
err
)
}
if
err
:=
validateRepo
(
tr
,
GCSPublicRepoName
,
GCSPublicRepoURL
,
""
,
GCSRepoFormat
,
GCSRepoType
);
err
!=
nil
{
if
err
:=
validateRepo
(
tr
,
GCSPublicRepoName
,
GCSPublicRepoURL
,
""
,
GCSRepoFormat
,
GCSRepoType
);
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
...
pkg/repo/repoprovider.go
View file @
873a8af4
...
@@ -33,7 +33,7 @@ import (
...
@@ -33,7 +33,7 @@ import (
type
IRepoProvider
interface
{
type
IRepoProvider
interface
{
GetRepoByURL
(
URL
string
)
(
IChartRepo
,
error
)
GetRepoByURL
(
URL
string
)
(
IChartRepo
,
error
)
GetRepoByName
(
repoName
string
)
(
IChartRepo
,
error
)
GetRepoByName
(
repoName
string
)
(
IChartRepo
,
error
)
GetChartByReference
(
reference
string
)
(
*
chart
.
Chart
,
error
)
GetChartByReference
(
reference
string
)
(
*
chart
.
Chart
,
IChartRepo
,
error
)
}
}
type
repoProvider
struct
{
type
repoProvider
struct
{
...
@@ -157,25 +157,30 @@ func (rp *repoProvider) findRepoByURL(URL string) IChartRepo {
...
@@ -157,25 +157,30 @@ func (rp *repoProvider) findRepoByURL(URL string) IChartRepo {
// GetChartByReference maps the supplied chart reference into a fully qualified
// GetChartByReference maps the supplied chart reference into a fully qualified
// URL, uses the URL to find the repository it references, queries the repository
// URL, uses the URL to find the repository it references, queries the repository
// for the chart by URL, and returns the
resul
t.
// for the chart by URL, and returns the
chart and the repository that backs i
t.
func
(
rp
*
repoProvider
)
GetChartByReference
(
reference
string
)
(
*
chart
.
Chart
,
error
)
{
func
(
rp
*
repoProvider
)
GetChartByReference
(
reference
string
)
(
*
chart
.
Chart
,
IChartRepo
,
error
)
{
l
,
err
:=
ParseGCSChartReference
(
reference
)
l
,
err
:=
ParseGCSChartReference
(
reference
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
nil
,
err
}
}
URL
,
err
:=
l
.
Long
(
true
)
URL
,
err
:=
l
.
Long
(
true
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"invalid reference %s: %s"
,
reference
,
err
)
return
nil
,
nil
,
fmt
.
Errorf
(
"invalid reference %s: %s"
,
reference
,
err
)
}
}
r
,
err
:=
rp
.
GetRepoByURL
(
URL
)
r
,
err
:=
rp
.
GetRepoByURL
(
URL
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
nil
,
err
}
}
name
:=
fmt
.
Sprintf
(
"%s-%s.tgz"
,
l
.
Name
,
l
.
Version
)
name
:=
fmt
.
Sprintf
(
"%s-%s.tgz"
,
l
.
Name
,
l
.
Version
)
return
r
.
GetChart
(
name
)
c
,
err
:=
r
.
GetChart
(
name
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
return
c
,
r
,
nil
}
}
// GCSRepoProvider is a factory for GCS IRepo instances.
// GCSRepoProvider is a factory for GCS IRepo instances.
...
...
pkg/repo/repoprovider_test.go
View file @
873a8af4
...
@@ -99,14 +99,14 @@ func TestGetChartByReferenceWithValidReferences(t *testing.T) {
...
@@ -99,14 +99,14 @@ func TestGetChartByReferenceWithValidReferences(t *testing.T) {
for
_
,
vcr
:=
range
ValidChartReferences
{
for
_
,
vcr
:=
range
ValidChartReferences
{
t
.
Logf
(
"getting chart by reference: %s"
,
vcr
)
t
.
Logf
(
"getting chart by reference: %s"
,
vcr
)
tc
,
err
:=
rp
.
GetChartByReference
(
vcr
)
tc
,
_
,
err
:=
rp
.
GetChartByReference
(
vcr
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Error
(
err
)
continue
continue
}
}
haveFile
:=
tc
.
Chartfile
()
haveFile
:=
tc
.
Chartfile
()
if
reflect
.
DeepEqual
(
wantFile
,
haveFile
)
{
if
!
reflect
.
DeepEqual
(
wantFile
,
haveFile
)
{
t
.
Fatalf
(
"retrieved invalid chart
\n
want:%#v
\n
have:
\n
%#v
\n
"
,
wantFile
,
haveFile
)
t
.
Fatalf
(
"retrieved invalid chart
\n
want:%#v
\n
have:
\n
%#v
\n
"
,
wantFile
,
haveFile
)
}
}
}
}
...
@@ -130,7 +130,7 @@ func getTestRepoProvider(t *testing.T) IRepoProvider {
...
@@ -130,7 +130,7 @@ func getTestRepoProvider(t *testing.T) IRepoProvider {
func
TestGetChartByReferenceWithInvalidReferences
(
t
*
testing
.
T
)
{
func
TestGetChartByReferenceWithInvalidReferences
(
t
*
testing
.
T
)
{
rp
:=
NewRepoProvider
(
nil
,
nil
,
nil
)
rp
:=
NewRepoProvider
(
nil
,
nil
,
nil
)
for
_
,
icr
:=
range
InvalidChartReferences
{
for
_
,
icr
:=
range
InvalidChartReferences
{
_
,
err
:=
rp
.
GetChartByReference
(
icr
)
_
,
_
,
err
:=
rp
.
GetChartByReference
(
icr
)
if
err
==
nil
{
if
err
==
nil
{
t
.
Fatalf
(
"found chart using invalid reference: %s"
,
icr
)
t
.
Fatalf
(
"found chart using invalid reference: %s"
,
icr
)
}
}
...
...
pkg/repo/types.go
View file @
873a8af4
...
@@ -118,7 +118,7 @@ type IStorageRepo interface {
...
@@ -118,7 +118,7 @@ type IStorageRepo interface {
// repository based operations, such as search and chart reference resolution.
// repository based operations, such as search and chart reference resolution.
type
IRepoService
interface
{
type
IRepoService
interface
{
// List returns the list of all known chart repositories
// List returns the list of all known chart repositories
List
()
([]
IRepo
,
error
)
List
()
([]
string
,
error
)
// Create adds a known repository to the list
// Create adds a known repository to the list
Create
(
repository
IRepo
)
error
Create
(
repository
IRepo
)
error
// Get returns the repository with the given name
// Get returns the repository with the given name
...
...
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