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
8a99a4aa
Commit
8a99a4aa
authored
Jun 07, 2017
by
Michelle Noorali
Committed by
Michelle Noorali
Jun 22, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ref(helm): rename FakeReleaseClient -> FakeClient
parent
70520efa
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
39 additions
and
39 deletions
+39
-39
delete_test.go
cmd/helm/delete_test.go
+1
-1
get_hooks_test.go
cmd/helm/get_hooks_test.go
+1
-1
get_manifest_test.go
cmd/helm/get_manifest_test.go
+1
-1
get_test.go
cmd/helm/get_test.go
+1
-1
get_values_test.go
cmd/helm/get_values_test.go
+1
-1
helm_test.go
cmd/helm/helm_test.go
+3
-3
history_test.go
cmd/helm/history_test.go
+1
-1
install_test.go
cmd/helm/install_test.go
+1
-1
list_test.go
cmd/helm/list_test.go
+1
-1
release_testing_test.go
cmd/helm/release_testing_test.go
+1
-1
reset_test.go
cmd/helm/reset_test.go
+4
-4
rollback_test.go
cmd/helm/rollback_test.go
+1
-1
status_test.go
cmd/helm/status_test.go
+2
-2
upgrade_test.go
cmd/helm/upgrade_test.go
+1
-1
version_test.go
cmd/helm/version_test.go
+1
-1
fake.go
pkg/helm/fake.go
+18
-18
No files found.
cmd/helm/delete_test.go
View file @
8a99a4aa
...
...
@@ -62,7 +62,7 @@ func TestDelete(t *testing.T) {
err
:
true
,
},
}
runReleaseCases
(
t
,
tests
,
func
(
c
*
helm
.
Fake
Release
Client
,
out
io
.
Writer
)
*
cobra
.
Command
{
runReleaseCases
(
t
,
tests
,
func
(
c
*
helm
.
FakeClient
,
out
io
.
Writer
)
*
cobra
.
Command
{
return
newDeleteCmd
(
c
,
out
)
})
}
cmd/helm/get_hooks_test.go
View file @
8a99a4aa
...
...
@@ -39,7 +39,7 @@ func TestGetHooks(t *testing.T) {
err
:
true
,
},
}
runReleaseCases
(
t
,
tests
,
func
(
c
*
helm
.
Fake
Release
Client
,
out
io
.
Writer
)
*
cobra
.
Command
{
runReleaseCases
(
t
,
tests
,
func
(
c
*
helm
.
FakeClient
,
out
io
.
Writer
)
*
cobra
.
Command
{
return
newGetHooksCmd
(
c
,
out
)
})
}
cmd/helm/get_manifest_test.go
View file @
8a99a4aa
...
...
@@ -39,7 +39,7 @@ func TestGetManifest(t *testing.T) {
err
:
true
,
},
}
runReleaseCases
(
t
,
tests
,
func
(
c
*
helm
.
Fake
Release
Client
,
out
io
.
Writer
)
*
cobra
.
Command
{
runReleaseCases
(
t
,
tests
,
func
(
c
*
helm
.
FakeClient
,
out
io
.
Writer
)
*
cobra
.
Command
{
return
newGetManifestCmd
(
c
,
out
)
})
}
cmd/helm/get_test.go
View file @
8a99a4aa
...
...
@@ -39,7 +39,7 @@ func TestGetCmd(t *testing.T) {
},
}
cmd
:=
func
(
c
*
helm
.
Fake
Release
Client
,
out
io
.
Writer
)
*
cobra
.
Command
{
cmd
:=
func
(
c
*
helm
.
FakeClient
,
out
io
.
Writer
)
*
cobra
.
Command
{
return
newGetCmd
(
c
,
out
)
}
runReleaseCases
(
t
,
tests
,
cmd
)
...
...
cmd/helm/get_values_test.go
View file @
8a99a4aa
...
...
@@ -38,7 +38,7 @@ func TestGetValuesCmd(t *testing.T) {
err
:
true
,
},
}
cmd
:=
func
(
c
*
helm
.
Fake
Release
Client
,
out
io
.
Writer
)
*
cobra
.
Command
{
cmd
:=
func
(
c
*
helm
.
FakeClient
,
out
io
.
Writer
)
*
cobra
.
Command
{
return
newGetValuesCmd
(
c
,
out
)
}
runReleaseCases
(
t
,
tests
,
cmd
)
...
...
cmd/helm/helm_test.go
View file @
8a99a4aa
...
...
@@ -120,14 +120,14 @@ func releaseMock(opts *releaseOptions) *release.Release {
}
}
// releaseCmd is a command that works with a Fake
Release
Client
type
releaseCmd
func
(
c
*
helm
.
Fake
Release
Client
,
out
io
.
Writer
)
*
cobra
.
Command
// releaseCmd is a command that works with a FakeClient
type
releaseCmd
func
(
c
*
helm
.
FakeClient
,
out
io
.
Writer
)
*
cobra
.
Command
// runReleaseCases runs a set of release cases through the given releaseCmd.
func
runReleaseCases
(
t
*
testing
.
T
,
tests
[]
releaseCase
,
rcmd
releaseCmd
)
{
var
buf
bytes
.
Buffer
for
_
,
tt
:=
range
tests
{
c
:=
&
helm
.
Fake
Release
Client
{
c
:=
&
helm
.
FakeClient
{
Rels
:
[]
*
release
.
Release
{
tt
.
resp
},
}
cmd
:=
rcmd
(
c
,
&
buf
)
...
...
cmd/helm/history_test.go
View file @
8a99a4aa
...
...
@@ -67,7 +67,7 @@ func TestHistoryCmd(t *testing.T) {
var
buf
bytes
.
Buffer
for
_
,
tt
:=
range
tests
{
frc
:=
&
helm
.
Fake
Release
Client
{
Rels
:
tt
.
resp
}
frc
:=
&
helm
.
FakeClient
{
Rels
:
tt
.
resp
}
cmd
:=
newHistoryCmd
(
frc
,
&
buf
)
cmd
.
ParseFlags
(
tt
.
args
)
...
...
cmd/helm/install_test.go
View file @
8a99a4aa
...
...
@@ -148,7 +148,7 @@ func TestInstall(t *testing.T) {
},
}
runReleaseCases
(
t
,
tests
,
func
(
c
*
helm
.
Fake
Release
Client
,
out
io
.
Writer
)
*
cobra
.
Command
{
runReleaseCases
(
t
,
tests
,
func
(
c
*
helm
.
FakeClient
,
out
io
.
Writer
)
*
cobra
.
Command
{
return
newInstallCmd
(
c
,
out
)
})
}
...
...
cmd/helm/list_test.go
View file @
8a99a4aa
...
...
@@ -102,7 +102,7 @@ func TestListCmd(t *testing.T) {
var
buf
bytes
.
Buffer
for
_
,
tt
:=
range
tests
{
c
:=
&
helm
.
Fake
Release
Client
{
c
:=
&
helm
.
FakeClient
{
Rels
:
tt
.
resp
,
}
cmd
:=
newListCmd
(
c
,
&
buf
)
...
...
cmd/helm/release_testing_test.go
View file @
8a99a4aa
...
...
@@ -83,7 +83,7 @@ func TestReleaseTesting(t *testing.T) {
}
for
_
,
tt
:=
range
tests
{
c
:=
&
helm
.
Fake
Release
Client
{
Responses
:
tt
.
responses
}
c
:=
&
helm
.
FakeClient
{
Responses
:
tt
.
responses
}
buf
:=
bytes
.
NewBuffer
(
nil
)
cmd
:=
newReleaseTestCmd
(
c
,
buf
)
...
...
cmd/helm/reset_test.go
View file @
8a99a4aa
...
...
@@ -39,7 +39,7 @@ func TestResetCmd(t *testing.T) {
defer
os
.
Remove
(
home
)
var
buf
bytes
.
Buffer
c
:=
&
helm
.
Fake
Release
Client
{}
c
:=
&
helm
.
FakeClient
{}
fc
:=
fake
.
NewSimpleClientset
()
cmd
:=
&
resetCmd
{
out
:
&
buf
,
...
...
@@ -72,7 +72,7 @@ func TestResetCmd_removeHelmHome(t *testing.T) {
defer
os
.
Remove
(
home
)
var
buf
bytes
.
Buffer
c
:=
&
helm
.
Fake
Release
Client
{}
c
:=
&
helm
.
FakeClient
{}
fc
:=
fake
.
NewSimpleClientset
()
cmd
:=
&
resetCmd
{
removeHelmHome
:
true
,
...
...
@@ -109,7 +109,7 @@ func TestReset_deployedReleases(t *testing.T) {
resp
:=
[]
*
release
.
Release
{
releaseMock
(
&
releaseOptions
{
name
:
"atlas-guide"
,
statusCode
:
release
.
Status_DEPLOYED
}),
}
c
:=
&
helm
.
Fake
Release
Client
{
c
:=
&
helm
.
FakeClient
{
Rels
:
resp
,
}
fc
:=
fake
.
NewSimpleClientset
()
...
...
@@ -141,7 +141,7 @@ func TestReset_forceFlag(t *testing.T) {
resp
:=
[]
*
release
.
Release
{
releaseMock
(
&
releaseOptions
{
name
:
"atlas-guide"
,
statusCode
:
release
.
Status_DEPLOYED
}),
}
c
:=
&
helm
.
Fake
Release
Client
{
c
:=
&
helm
.
FakeClient
{
Rels
:
resp
,
}
fc
:=
fake
.
NewSimpleClientset
()
...
...
cmd/helm/rollback_test.go
View file @
8a99a4aa
...
...
@@ -52,7 +52,7 @@ func TestRollbackCmd(t *testing.T) {
},
}
cmd
:=
func
(
c
*
helm
.
Fake
Release
Client
,
out
io
.
Writer
)
*
cobra
.
Command
{
cmd
:=
func
(
c
*
helm
.
FakeClient
,
out
io
.
Writer
)
*
cobra
.
Command
{
return
newRollbackCmd
(
c
,
out
)
}
...
...
cmd/helm/status_test.go
View file @
8a99a4aa
...
...
@@ -107,13 +107,13 @@ func TestStatusCmd(t *testing.T) {
},
}
scmd
:=
func
(
c
*
helm
.
Fake
Release
Client
,
out
io
.
Writer
)
*
cobra
.
Command
{
scmd
:=
func
(
c
*
helm
.
FakeClient
,
out
io
.
Writer
)
*
cobra
.
Command
{
return
newStatusCmd
(
c
,
out
)
}
var
buf
bytes
.
Buffer
for
_
,
tt
:=
range
tests
{
c
:=
&
helm
.
Fake
Release
Client
{
c
:=
&
helm
.
FakeClient
{
Rels
:
[]
*
release
.
Release
{
tt
.
rel
},
}
cmd
:=
scmd
(
c
,
&
buf
)
...
...
cmd/helm/upgrade_test.go
View file @
8a99a4aa
...
...
@@ -153,7 +153,7 @@ func TestUpgradeCmd(t *testing.T) {
},
}
cmd
:=
func
(
c
*
helm
.
Fake
Release
Client
,
out
io
.
Writer
)
*
cobra
.
Command
{
cmd
:=
func
(
c
*
helm
.
FakeClient
,
out
io
.
Writer
)
*
cobra
.
Command
{
return
newUpgradeCmd
(
c
,
out
)
}
...
...
cmd/helm/version_test.go
View file @
8a99a4aa
...
...
@@ -43,7 +43,7 @@ func TestVersion(t *testing.T) {
settings
.
TillerHost
=
"fake-localhost"
for
_
,
tt
:=
range
tests
{
b
:=
new
(
bytes
.
Buffer
)
c
:=
&
helm
.
Fake
Release
Client
{}
c
:=
&
helm
.
FakeClient
{}
cmd
:=
newVersionCmd
(
c
,
b
)
cmd
.
ParseFlags
(
tt
.
args
)
...
...
pkg/helm/fake.go
View file @
8a99a4aa
...
...
@@ -26,18 +26,18 @@ import (
"k8s.io/helm/pkg/proto/hapi/version"
)
// Fake
Release
Client implements Interface
type
Fake
Release
Client
struct
{
// FakeClient implements Interface
type
FakeClient
struct
{
Rels
[]
*
release
.
Release
Responses
map
[
string
]
release
.
TestRun_Status
Err
error
}
var
_
Interface
=
&
Fake
Release
Client
{}
var
_
Interface
=
(
*
Fake
Release
Client
)(
nil
)
var
_
Interface
=
&
FakeClient
{}
var
_
Interface
=
(
*
FakeClient
)(
nil
)
// List
r
eleases lists the current releases
func
(
c
*
Fake
Release
Client
)
ListReleases
(
opts
...
ReleaseListOption
)
(
*
rls
.
ListReleasesResponse
,
error
)
{
// List
R
eleases lists the current releases
func
(
c
*
FakeClient
)
ListReleases
(
opts
...
ReleaseListOption
)
(
*
rls
.
ListReleasesResponse
,
error
)
{
resp
:=
&
rls
.
ListReleasesResponse
{
Count
:
int64
(
len
(
c
.
Rels
)),
Releases
:
c
.
Rels
,
...
...
@@ -46,31 +46,31 @@ func (c *FakeReleaseClient) ListReleases(opts ...ReleaseListOption) (*rls.ListRe
}
// InstallRelease returns a response with the first Release on the fake release client
func
(
c
*
Fake
Release
Client
)
InstallRelease
(
chStr
,
ns
string
,
opts
...
InstallOption
)
(
*
rls
.
InstallReleaseResponse
,
error
)
{
func
(
c
*
FakeClient
)
InstallRelease
(
chStr
,
ns
string
,
opts
...
InstallOption
)
(
*
rls
.
InstallReleaseResponse
,
error
)
{
return
&
rls
.
InstallReleaseResponse
{
Release
:
c
.
Rels
[
0
],
},
nil
}
// InstallReleaseFromChart returns a response with the first Release on the fake release client
func
(
c
*
Fake
Release
Client
)
InstallReleaseFromChart
(
chart
*
chart
.
Chart
,
ns
string
,
opts
...
InstallOption
)
(
*
rls
.
InstallReleaseResponse
,
error
)
{
func
(
c
*
FakeClient
)
InstallReleaseFromChart
(
chart
*
chart
.
Chart
,
ns
string
,
opts
...
InstallOption
)
(
*
rls
.
InstallReleaseResponse
,
error
)
{
return
&
rls
.
InstallReleaseResponse
{
Release
:
c
.
Rels
[
0
],
},
nil
}
// DeleteRelease returns nil, nil
func
(
c
*
Fake
Release
Client
)
DeleteRelease
(
rlsName
string
,
opts
...
DeleteOption
)
(
*
rls
.
UninstallReleaseResponse
,
error
)
{
func
(
c
*
FakeClient
)
DeleteRelease
(
rlsName
string
,
opts
...
DeleteOption
)
(
*
rls
.
UninstallReleaseResponse
,
error
)
{
return
nil
,
nil
}
// UpdateRelease returns nil, nil
func
(
c
*
Fake
Release
Client
)
UpdateRelease
(
rlsName
string
,
chStr
string
,
opts
...
UpdateOption
)
(
*
rls
.
UpdateReleaseResponse
,
error
)
{
func
(
c
*
FakeClient
)
UpdateRelease
(
rlsName
string
,
chStr
string
,
opts
...
UpdateOption
)
(
*
rls
.
UpdateReleaseResponse
,
error
)
{
return
nil
,
nil
}
// GetVersion returns a fake version
func
(
c
*
Fake
Release
Client
)
GetVersion
(
opts
...
VersionOption
)
(
*
rls
.
GetVersionResponse
,
error
)
{
func
(
c
*
FakeClient
)
GetVersion
(
opts
...
VersionOption
)
(
*
rls
.
GetVersionResponse
,
error
)
{
return
&
rls
.
GetVersionResponse
{
Version
:
&
version
.
Version
{
SemVer
:
"1.2.3-fakeclient+testonly"
,
...
...
@@ -79,18 +79,18 @@ func (c *FakeReleaseClient) GetVersion(opts ...VersionOption) (*rls.GetVersionRe
}
// UpdateReleaseFromChart returns nil, nil
func
(
c
*
Fake
Release
Client
)
UpdateReleaseFromChart
(
rlsName
string
,
chart
*
chart
.
Chart
,
opts
...
UpdateOption
)
(
*
rls
.
UpdateReleaseResponse
,
error
)
{
func
(
c
*
FakeClient
)
UpdateReleaseFromChart
(
rlsName
string
,
chart
*
chart
.
Chart
,
opts
...
UpdateOption
)
(
*
rls
.
UpdateReleaseResponse
,
error
)
{
return
nil
,
nil
}
// RollbackRelease returns nil, nil
func
(
c
*
Fake
Release
Client
)
RollbackRelease
(
rlsName
string
,
opts
...
RollbackOption
)
(
*
rls
.
RollbackReleaseResponse
,
error
)
{
func
(
c
*
FakeClient
)
RollbackRelease
(
rlsName
string
,
opts
...
RollbackOption
)
(
*
rls
.
RollbackReleaseResponse
,
error
)
{
return
nil
,
nil
}
// ReleaseStatus returns a release status response with info from the first release in the fake
// release client
func
(
c
*
Fake
Release
Client
)
ReleaseStatus
(
rlsName
string
,
opts
...
StatusOption
)
(
*
rls
.
GetReleaseStatusResponse
,
error
)
{
func
(
c
*
FakeClient
)
ReleaseStatus
(
rlsName
string
,
opts
...
StatusOption
)
(
*
rls
.
GetReleaseStatusResponse
,
error
)
{
if
c
.
Rels
[
0
]
!=
nil
{
return
&
rls
.
GetReleaseStatusResponse
{
Name
:
c
.
Rels
[
0
]
.
Name
,
...
...
@@ -102,7 +102,7 @@ func (c *FakeReleaseClient) ReleaseStatus(rlsName string, opts ...StatusOption)
}
// ReleaseContent returns the configuration for the first release in the fake release client
func
(
c
*
Fake
Release
Client
)
ReleaseContent
(
rlsName
string
,
opts
...
ContentOption
)
(
resp
*
rls
.
GetReleaseContentResponse
,
err
error
)
{
func
(
c
*
FakeClient
)
ReleaseContent
(
rlsName
string
,
opts
...
ContentOption
)
(
resp
*
rls
.
GetReleaseContentResponse
,
err
error
)
{
if
len
(
c
.
Rels
)
>
0
{
resp
=
&
rls
.
GetReleaseContentResponse
{
Release
:
c
.
Rels
[
0
],
...
...
@@ -112,12 +112,12 @@ func (c *FakeReleaseClient) ReleaseContent(rlsName string, opts ...ContentOption
}
// ReleaseHistory returns a release's revision history.
func
(
c
*
Fake
Release
Client
)
ReleaseHistory
(
rlsName
string
,
opts
...
HistoryOption
)
(
*
rls
.
GetHistoryResponse
,
error
)
{
func
(
c
*
FakeClient
)
ReleaseHistory
(
rlsName
string
,
opts
...
HistoryOption
)
(
*
rls
.
GetHistoryResponse
,
error
)
{
return
&
rls
.
GetHistoryResponse
{
Releases
:
c
.
Rels
},
c
.
Err
}
// RunReleaseTest executes a pre-defined tests on a release
func
(
c
*
Fake
Release
Client
)
RunReleaseTest
(
rlsName
string
,
opts
...
ReleaseTestOption
)
(
<-
chan
*
rls
.
TestReleaseResponse
,
<-
chan
error
)
{
func
(
c
*
FakeClient
)
RunReleaseTest
(
rlsName
string
,
opts
...
ReleaseTestOption
)
(
<-
chan
*
rls
.
TestReleaseResponse
,
<-
chan
error
)
{
results
:=
make
(
chan
*
rls
.
TestReleaseResponse
)
errc
:=
make
(
chan
error
,
1
)
...
...
@@ -142,6 +142,6 @@ func (c *FakeReleaseClient) RunReleaseTest(rlsName string, opts ...ReleaseTestOp
}
// Option returns the fake release client
func
(
c
*
Fake
Release
Client
)
Option
(
opt
...
Option
)
Interface
{
func
(
c
*
FakeClient
)
Option
(
opt
...
Option
)
Interface
{
return
c
}
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