diff --git a/cmd/helm/list_test.go b/cmd/helm/list_test.go index 08dff52aa..e017265d6 100644 --- a/cmd/helm/list_test.go +++ b/cmd/helm/list_test.go @@ -26,14 +26,19 @@ import ( func TestListCmd(t *testing.T) { 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{ Metadata: &chart.Metadata{ Name: "chickadee", Version: "1.0.0", }, } + releaseFixture := []*release.Release{ { Name: "starlord", @@ -105,6 +110,26 @@ func TestListCmd(t *testing.T) { }, 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{{ @@ -152,6 +177,11 @@ func TestListCmd(t *testing.T) { cmd: "list --reverse", golden: "output/list-reverse.txt", 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", cmd: "list --short", diff --git a/cmd/helm/testdata/output/list-date-reversed.txt b/cmd/helm/testdata/output/list-date-reversed.txt new file mode 100644 index 000000000..46126f82e --- /dev/null +++ b/cmd/helm/testdata/output/list-date-reversed.txt @@ -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 diff --git a/cmd/helm/testdata/output/list.txt b/cmd/helm/testdata/output/list.txt index 46126f82e..55a4ac8af 100644 --- a/cmd/helm/testdata/output/list.txt +++ b/cmd/helm/testdata/output/list.txt @@ -1,3 +1,5 @@ -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 +NAME NAMESPACE REVISION UPDATED STATUS CHART +hummingbird default 1 2016-01-16 00:00:03 +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