add more releases to list tests

Signed-off-by: Abhilash Gnan <abhilashgnan@gmail.com>
pull/5539/head
Abhilash Gnan 6 years ago
parent 20c4d29295
commit 537872526b

@ -26,14 +26,19 @@ import (
func TestListCmd(t *testing.T) { func TestListCmd(t *testing.T) {
defaultNamespace := "default" defaultNamespace := "default"
timestamp1 := time.Unix(1452902400, 0).UTC()
timestamp2 := time.Unix(1452902401, 0).UTC() sampleTimeSeconds := int64(1452902400)
timestamp1 := time.Unix(sampleTimeSeconds+1, 0).UTC()
timestamp2 := time.Unix(sampleTimeSeconds+2, 0).UTC()
timestamp3 := time.Unix(sampleTimeSeconds+3, 0).UTC()
timestamp4 := time.Unix(sampleTimeSeconds+4, 0).UTC()
chartInfo := &chart.Chart{ chartInfo := &chart.Chart{
Metadata: &chart.Metadata{ Metadata: &chart.Metadata{
Name: "chickadee", Name: "chickadee",
Version: "1.0.0", Version: "1.0.0",
}, },
} }
releaseFixture := []*release.Release{ releaseFixture := []*release.Release{
{ {
Name: "starlord", Name: "starlord",
@ -105,6 +110,26 @@ func TestListCmd(t *testing.T) {
}, },
Chart: chartInfo, Chart: chartInfo,
}, },
{
Name: "hummingbird",
Version: 1,
Namespace: defaultNamespace,
Info: &release.Info{
LastDeployed: timestamp3,
Status: release.StatusDeployed,
},
Chart: chartInfo,
},
{
Name: "iguana",
Version: 2,
Namespace: defaultNamespace,
Info: &release.Info{
LastDeployed: timestamp4,
Status: release.StatusDeployed,
},
Chart: chartInfo,
},
} }
tests := []cmdTestCase{{ tests := []cmdTestCase{{
@ -152,6 +177,11 @@ func TestListCmd(t *testing.T) {
cmd: "list --reverse", cmd: "list --reverse",
golden: "output/list-reverse.txt", golden: "output/list-reverse.txt",
rels: releaseFixture, rels: releaseFixture,
}, {
name: "list releases sorted by reversed release date",
cmd: "list --date --reverse",
golden: "output/list-date-reversed.txt",
rels: releaseFixture,
}, { }, {
name: "list releases in short output format", name: "list releases in short output format",
cmd: "list --short", cmd: "list --short",

@ -0,0 +1,3 @@
NAME NAMESPACE REVISION UPDATED STATUS CHART
rocket default 1 2016-01-16 00:00:01 +0000 UTC failed chickadee-1.0.0
starlord default 2 2016-01-16 00:00:00 +0000 UTC deployed chickadee-1.0.0

@ -1,3 +1,5 @@
NAME NAMESPACE REVISION UPDATED STATUS CHART NAME NAMESPACE REVISION UPDATED STATUS CHART
rocket default 1 2016-01-16 00:00:01 +0000 UTC failed chickadee-1.0.0 hummingbird default 1 2016-01-16 00:00:03 +0000 UTC deployed chickadee-1.0.0
starlord default 2 2016-01-16 00:00:00 +0000 UTC deployed chickadee-1.0.0 iguana default 2 2016-01-16 00:00:04 +0000 UTC deployed chickadee-1.0.0
rocket default 1 2016-01-16 00:00:02 +0000 UTC failed chickadee-1.0.0
starlord default 2 2016-01-16 00:00:01 +0000 UTC deployed chickadee-1.0.0

Loading…
Cancel
Save