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
4df486e3
Commit
4df486e3
authored
Mar 24, 2016
by
Michelle Noorali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(repo): add GetRepoURLByName test
* + fix old repo tests for Name addition
parent
6e96c333
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
9 deletions
+33
-9
gcs_repo_test.go
pkg/repo/gcs_repo_test.go
+3
-2
inmem_repo_service_test.go
pkg/repo/inmem_repo_service_test.go
+25
-2
repo_test.go
pkg/repo/repo_test.go
+4
-4
repoprovider_test.go
pkg/repo/repoprovider_test.go
+1
-1
No files found.
pkg/repo/gcs_repo_test.go
View file @
4df486e3
...
...
@@ -33,6 +33,7 @@ var (
TestChartFile
=
"testdata/frobnitz/Chart.yaml"
TestShouldFindRegex
=
regexp
.
MustCompile
(
TestArchiveName
)
TestShouldNotFindRegex
=
regexp
.
MustCompile
(
"foobar"
)
TestName
=
"bucket-name"
)
func
TestValidGSURL
(
t
*
testing
.
T
)
{
...
...
@@ -51,7 +52,7 @@ func TestValidGSURL(t *testing.T) {
func
TestInvalidGSURL
(
t
*
testing
.
T
)
{
var
invalidGSURL
=
"https://valid.url/wrong/scheme"
_
,
err
:=
NewGCSRepo
(
invalidGSURL
,
TestRepoCredentialName
,
nil
)
_
,
err
:=
NewGCSRepo
(
invalidGSURL
,
TestRepoCredentialName
,
TestName
,
nil
)
if
err
==
nil
{
t
.
Fatalf
(
"expected error did not occur for invalid GS URL"
)
}
...
...
@@ -126,7 +127,7 @@ func TestGetChartWithInvalidName(t *testing.T) {
}
func
getTestRepo
(
t
*
testing
.
T
)
IStorageRepo
{
tr
,
err
:=
NewGCSRepo
(
TestRepoURL
,
TestRepoCredentialName
,
nil
)
tr
,
err
:=
NewGCSRepo
(
TestRepoURL
,
TestRepoCredentialName
,
TestName
,
nil
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
pkg/repo/inmem_repo_service_test.go
View file @
4df486e3
...
...
@@ -32,7 +32,11 @@ func TestService(t *testing.T) {
t
.
Fatalf
(
"unexpected repo count; want: %d, have %d."
,
1
,
len
(
repos
))
}
tr
,
err
:=
rs
.
GetRepoByURL
(
repos
[
0
])
u
:=
""
for
_
,
url
:=
range
repos
{
u
=
url
}
tr
,
err
:=
rs
.
GetRepoByURL
(
u
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
@@ -71,7 +75,7 @@ func TestService(t *testing.T) {
func
TestCreateRepoWithDuplicateURL
(
t
*
testing
.
T
)
{
rs
:=
NewInmemRepoService
()
r
,
err
:=
newRepo
(
GCSPublicRepoURL
,
""
,
GCSRepoFormat
,
GCSRepoType
)
r
,
err
:=
newRepo
(
GCSPublicRepoURL
,
""
,
TestName
,
GCSRepoFormat
,
GCSRepoType
)
if
err
!=
nil
{
t
.
Fatalf
(
"cannot create test repo: %s"
,
err
)
}
...
...
@@ -90,6 +94,25 @@ func TestGetRepoWithInvalidURL(t *testing.T) {
}
}
func
TestGetRepoURLByName
(
t
*
testing
.
T
)
{
rs
:=
NewInmemRepoService
()
testURL
:=
"gcs://helm-test-charts"
r
,
err
:=
newRepo
(
testURL
,
""
,
TestName
,
GCSRepoFormat
,
GCSRepoType
)
err
=
rs
.
CreateRepo
(
r
)
if
err
!=
nil
{
t
.
Fatalf
(
"Error creating repo: %s"
,
err
)
}
expectedURL
:=
testURL
actualURL
,
err
:=
rs
.
GetRepoURLByName
(
TestName
)
if
err
!=
nil
{
t
.
Fatalf
(
"%v"
,
err
)
}
if
expectedURL
!=
actualURL
{
t
.
Fatalf
(
"Incorrect resulting URL. Expected %s. Got %s"
,
expectedURL
,
actualURL
)
}
}
func
TestGetRepoWithInvalidChartURL
(
t
*
testing
.
T
)
{
invalidURL
:=
"https://not.a.valid/url"
rs
:=
NewInmemRepoService
()
...
...
pkg/repo/repo_test.go
View file @
4df486e3
...
...
@@ -29,7 +29,7 @@ var (
)
func
TestValidRepoURL
(
t
*
testing
.
T
)
{
tr
,
err
:=
NewRepo
(
TestRepoURL
,
TestRepoCredentialName
,
string
(
TestRepoFormat
),
string
(
TestRepoType
))
tr
,
err
:=
NewRepo
(
TestRepoURL
,
TestRepoCredentialName
,
TestRepoBucket
,
string
(
TestRepoFormat
),
string
(
TestRepoType
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
@@ -40,14 +40,14 @@ func TestValidRepoURL(t *testing.T) {
}
func
TestInvalidRepoURL
(
t
*
testing
.
T
)
{
_
,
err
:=
newRepo
(
"%:invalid&url:%"
,
TestRepoCredentialName
,
TestRepoFormat
,
TestRepoType
)
_
,
err
:=
newRepo
(
"%:invalid&url:%"
,
TestRepoCredentialName
,
TestRepo
Bucket
,
TestRepo
Format
,
TestRepoType
)
if
err
==
nil
{
t
.
Fatalf
(
"expected error did not occur for invalid URL"
)
}
}
func
TestDefaultCredentialName
(
t
*
testing
.
T
)
{
tr
,
err
:=
newRepo
(
TestRepoURL
,
""
,
TestRepoFormat
,
TestRepoType
)
tr
,
err
:=
newRepo
(
TestRepoURL
,
""
,
TestRepo
Bucket
,
TestRepo
Format
,
TestRepoType
)
if
err
!=
nil
{
t
.
Fatalf
(
"cannot create repo using default credential name"
)
}
...
...
@@ -60,7 +60,7 @@ func TestDefaultCredentialName(t *testing.T) {
}
func
TestInvalidRepoFormat
(
t
*
testing
.
T
)
{
_
,
err
:=
newRepo
(
TestRepoURL
,
TestRepoCredentialName
,
""
,
TestRepoType
)
_
,
err
:=
newRepo
(
TestRepoURL
,
TestRepoCredentialName
,
TestRepoBucket
,
""
,
TestRepoType
)
if
err
==
nil
{
t
.
Fatalf
(
"expected error did not occur for invalid format"
)
}
...
...
pkg/repo/repoprovider_test.go
View file @
4df486e3
...
...
@@ -116,7 +116,7 @@ func TestGetChartByReferenceWithValidReferences(t *testing.T) {
func
getTestRepoProvider
(
t
*
testing
.
T
)
IRepoProvider
{
rp
:=
newRepoProvider
(
nil
,
nil
,
nil
)
rs
:=
rp
.
GetRepoService
()
tr
,
err
:=
newRepo
(
TestRepoURL
,
TestRepoCredentialName
,
TestRepoFormat
,
TestRepoType
)
tr
,
err
:=
newRepo
(
TestRepoURL
,
TestRepoCredentialName
,
Test
Name
,
Test
RepoFormat
,
TestRepoType
)
if
err
!=
nil
{
t
.
Fatalf
(
"cannot create test repository: %s"
,
err
)
}
...
...
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