|
|
|
@ -24,53 +24,6 @@ import (
|
|
|
|
|
"k8s.io/helm/pkg/proto/hapi/release"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestListRun(t *testing.T) {
|
|
|
|
|
tests := []struct {
|
|
|
|
|
name string
|
|
|
|
|
listCmd *listCmd
|
|
|
|
|
expected string
|
|
|
|
|
err bool
|
|
|
|
|
}{
|
|
|
|
|
{
|
|
|
|
|
name: "with a release",
|
|
|
|
|
listCmd: &listCmd{
|
|
|
|
|
client: &fakeReleaseClient{
|
|
|
|
|
rels: []*release.Release{
|
|
|
|
|
releaseMock("thomas-guide"),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
expected: "thomas-guide",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "list --long",
|
|
|
|
|
listCmd: &listCmd{
|
|
|
|
|
client: &fakeReleaseClient{
|
|
|
|
|
rels: []*release.Release{
|
|
|
|
|
releaseMock("atlas"),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
long: true,
|
|
|
|
|
},
|
|
|
|
|
expected: "NAME \tVERSION\tUPDATED \tSTATUS \tCHART \natlas\t1 \t(.*)\tDEPLOYED\tfoo-0.1.0-beta.1\n",
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var buf bytes.Buffer
|
|
|
|
|
for _, tt := range tests {
|
|
|
|
|
tt.listCmd.out = &buf
|
|
|
|
|
err := tt.listCmd.run()
|
|
|
|
|
if (err != nil) != tt.err {
|
|
|
|
|
t.Errorf("%q. expected error: %v, got %v", tt.name, tt.err, err)
|
|
|
|
|
}
|
|
|
|
|
re := regexp.MustCompile(tt.expected)
|
|
|
|
|
if !re.Match(buf.Bytes()) {
|
|
|
|
|
t.Errorf("%q. expected %q, got %q", tt.name, tt.expected, buf.String())
|
|
|
|
|
}
|
|
|
|
|
buf.Reset()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestListCmd(t *testing.T) {
|
|
|
|
|
tests := []struct {
|
|
|
|
|
name string
|
|
|
|
|