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
f51170ed
Commit
f51170ed
authored
May 11, 2016
by
Matt Butcher
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #693 from technosophos/feat/storage-history
feat(tiller): stub in release history
parents
8ae7eb7d
938dbf09
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
1 deletion
+41
-1
environment.go
cmd/tiller/environment/environment.go
+3
-0
environment_test.go
cmd/tiller/environment/environment_test.go
+10
-0
memory.go
pkg/storage/memory.go
+12
-1
memory_test.go
pkg/storage/memory_test.go
+16
-0
No files found.
cmd/tiller/environment/environment.go
View file @
f51170ed
...
...
@@ -116,6 +116,9 @@ type ReleaseStorage interface {
// Query will search all releases, including deleted and superseded ones.
// The provided map will be used to filter results.
Query
(
map
[
string
]
string
)
([]
*
release
.
Release
,
error
)
// History takes a release name and returns the history of releases.
History
(
name
string
)
([]
*
release
.
Release
,
error
)
}
// KubeClient represents a client capable of communicating with the Kubernetes API.
...
...
cmd/tiller/environment/environment_test.go
View file @
f51170ed
...
...
@@ -47,6 +47,16 @@ func (r *mockReleaseStorage) Query(labels map[string]string) ([]*release.Release
return
[]
*
release
.
Release
{},
nil
}
func
(
r
*
mockReleaseStorage
)
History
(
n
string
)
([]
*
release
.
Release
,
error
)
{
res
:=
[]
*
release
.
Release
{}
rel
,
err
:=
r
.
Read
(
n
)
if
err
!=
nil
{
return
res
,
err
}
res
=
append
(
res
,
rel
)
return
res
,
nil
}
type
mockKubeClient
struct
{
}
...
...
pkg/storage/memory.go
View file @
f51170ed
...
...
@@ -87,5 +87,16 @@ func (m *Memory) List() ([]*release.Release, error) {
func
(
m
*
Memory
)
Query
(
labels
map
[
string
]
string
)
([]
*
release
.
Release
,
error
)
{
m
.
RLock
()
defer
m
.
RUnlock
()
return
[]
*
release
.
Release
{},
errors
.
New
(
"Cannot implement until release.Release is defined."
)
return
[]
*
release
.
Release
{},
errors
.
New
(
"not implemented"
)
}
// History returns the history of this release, in the form of a series of releases.
func
(
m
*
Memory
)
History
(
name
string
)
([]
*
release
.
Release
,
error
)
{
// TODO: This _should_ return all of the releases with the given name, sorted
// by LastDeployed, regardless of status.
r
,
err
:=
m
.
Read
(
name
)
if
err
!=
nil
{
return
[]
*
release
.
Release
{},
err
}
return
[]
*
release
.
Release
{
r
},
nil
}
pkg/storage/memory_test.go
View file @
f51170ed
...
...
@@ -34,6 +34,22 @@ func TestRead(t *testing.T) {
}
}
func
TestHistory
(
t
*
testing
.
T
)
{
k
:=
"test-1"
r
:=
&
release
.
Release
{
Name
:
k
}
ms
:=
NewMemory
()
ms
.
Create
(
r
)
if
out
,
err
:=
ms
.
History
(
k
);
err
!=
nil
{
t
.
Errorf
(
"Could not get %s: %s"
,
k
,
err
)
}
else
if
len
(
out
)
!=
1
{
t
.
Fatalf
(
"Expected 1 release, got %d"
,
len
(
out
))
}
else
if
out
[
0
]
.
Name
!=
k
{
t
.
Errorf
(
"Expected %s, got %s"
,
k
,
out
[
0
]
.
Name
)
}
}
func
TestUpdate
(
t
*
testing
.
T
)
{
k
:=
"test-1"
r
:=
&
release
.
Release
{
Name
:
k
}
...
...
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