From d3c85f97c2ae96d55d2646e17763eecc07d88815 Mon Sep 17 00:00:00 2001 From: Abhilash Gnan Date: Tue, 2 Apr 2019 21:14:13 +0200 Subject: [PATCH 01/11] fix sort list with options bug Signed-off-by: Abhilash Gnan --- cmd/helm/list.go | 2 +- pkg/action/list.go | 27 ++++++++++++++++++++++----- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/cmd/helm/list.go b/cmd/helm/list.go index 7ed340482..cd56cff79 100644 --- a/cmd/helm/list.go +++ b/cmd/helm/list.go @@ -86,7 +86,7 @@ func newListCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { f := cmd.Flags() f.BoolVarP(&client.Short, "short", "q", false, "output short (quiet) listing format") f.BoolVarP(&client.ByDate, "date", "d", false, "sort by release date") - f.BoolVarP(&client.SortDesc, "reverse", "r", false, "reverse the sort order") + f.BoolVarP(&client.SortReverse, "reverse", "r", false, "reverse the sort order") f.BoolVarP(&client.All, "all", "a", false, "show all releases, not just the ones marked deployed") f.BoolVar(&client.Uninstalled, "uninstalled", false, "show uninstalled releases") f.BoolVar(&client.Superseded, "superseded", false, "show superseded releases") diff --git a/pkg/action/list.go b/pkg/action/list.go index 063b4d28e..9e2e5258a 100644 --- a/pkg/action/list.go +++ b/pkg/action/list.go @@ -87,8 +87,10 @@ const ListAll = ListDeployed | ListUninstalled | ListUninstalling | ListPendingI type Sorter uint const ( - // ByDate sorts by date - ByDate Sorter = iota + // ByDateAsc sorts by ascending dates (oldest updated release first) + ByDateAsc Sorter = iota + // ByDateDesc sorts by descending dates (latest updated release first) + ByDateDesc // ByNameAsc sorts by ascending lexicographic order ByNameAsc // ByNameDesc sorts by descending lexicographic order @@ -109,6 +111,9 @@ type List struct { // // see pkg/releaseutil for several useful sorters Sort Sorter + // Overrides the default lexicographic sorting + ByDate bool + SortReverse bool // StateMask accepts a bitmask of states for items to show. // The default is ListDeployed StateMask ListStates @@ -119,8 +124,6 @@ type List struct { // Filter is a filter that is applied to the results Filter string Short bool - ByDate bool - SortDesc bool Uninstalled bool Superseded bool Uninstalling bool @@ -194,9 +197,23 @@ func (l *List) Run() ([]*release.Release, error) { // sort is an in-place sort where order is based on the value of a.Sort func (l *List) sort(rels []*release.Release) { + l.Sort = ByNameAsc + if l.SortReverse { + l.Sort = ByNameDesc + } + + if l.ByDate { + l.Sort = ByDateDesc + if l.SortReverse { + l.Sort = ByDateAsc + } + } + switch l.Sort { - case ByDate: + case ByDateDesc: releaseutil.SortByDate(rels) + case ByDateAsc: + releaseutil.Reverse(rels, releaseutil.SortByDate) case ByNameDesc: releaseutil.Reverse(rels, releaseutil.SortByName) default: From 05523b5d84caa62d88a5ca8b2d6001c39bb2e93e Mon Sep 17 00:00:00 2001 From: Abhilash Gnan Date: Tue, 2 Apr 2019 21:14:32 +0200 Subject: [PATCH 02/11] fix test cases for sort list with options Signed-off-by: Abhilash Gnan --- cmd/helm/testdata/output/list-all.txt | 2 +- cmd/helm/testdata/output/list-filter.txt | 2 +- cmd/helm/testdata/output/list-max.txt | 4 ++-- cmd/helm/testdata/output/list-offset.txt | 4 ++-- cmd/helm/testdata/output/list-short.txt | 2 +- cmd/helm/testdata/output/list-superseded.txt | 2 +- cmd/helm/testdata/output/list.txt | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cmd/helm/testdata/output/list-all.txt b/cmd/helm/testdata/output/list-all.txt index c93262d24..46126f82e 100644 --- a/cmd/helm/testdata/output/list-all.txt +++ b/cmd/helm/testdata/output/list-all.txt @@ -1,3 +1,3 @@ NAME NAMESPACE REVISION UPDATED STATUS CHART -starlord default 2 2016-01-16 00:00:00 +0000 UTC deployed chickadee-1.0.0 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-filter.txt b/cmd/helm/testdata/output/list-filter.txt index c93262d24..46126f82e 100644 --- a/cmd/helm/testdata/output/list-filter.txt +++ b/cmd/helm/testdata/output/list-filter.txt @@ -1,3 +1,3 @@ NAME NAMESPACE REVISION UPDATED STATUS CHART -starlord default 2 2016-01-16 00:00:00 +0000 UTC deployed chickadee-1.0.0 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-max.txt b/cmd/helm/testdata/output/list-max.txt index 8d93a9a09..f9e56e313 100644 --- a/cmd/helm/testdata/output/list-max.txt +++ b/cmd/helm/testdata/output/list-max.txt @@ -1,2 +1,2 @@ -NAME NAMESPACE REVISION UPDATED STATUS CHART -starlord default 2 2016-01-16 00:00:00 +0000 UTC deployed chickadee-1.0.0 +NAME NAMESPACE REVISION UPDATED STATUS CHART +rocket default 1 2016-01-16 00:00:01 +0000 UTC failed chickadee-1.0.0 diff --git a/cmd/helm/testdata/output/list-offset.txt b/cmd/helm/testdata/output/list-offset.txt index f9e56e313..8d93a9a09 100644 --- a/cmd/helm/testdata/output/list-offset.txt +++ b/cmd/helm/testdata/output/list-offset.txt @@ -1,2 +1,2 @@ -NAME NAMESPACE REVISION UPDATED STATUS CHART -rocket default 1 2016-01-16 00:00:01 +0000 UTC failed chickadee-1.0.0 +NAME NAMESPACE REVISION UPDATED STATUS CHART +starlord default 2 2016-01-16 00:00:00 +0000 UTC deployed chickadee-1.0.0 diff --git a/cmd/helm/testdata/output/list-short.txt b/cmd/helm/testdata/output/list-short.txt index 5f7151e5e..33d328424 100644 --- a/cmd/helm/testdata/output/list-short.txt +++ b/cmd/helm/testdata/output/list-short.txt @@ -1,2 +1,2 @@ -starlord rocket +starlord diff --git a/cmd/helm/testdata/output/list-superseded.txt b/cmd/helm/testdata/output/list-superseded.txt index c93262d24..46126f82e 100644 --- a/cmd/helm/testdata/output/list-superseded.txt +++ b/cmd/helm/testdata/output/list-superseded.txt @@ -1,3 +1,3 @@ NAME NAMESPACE REVISION UPDATED STATUS CHART -starlord default 2 2016-01-16 00:00:00 +0000 UTC deployed chickadee-1.0.0 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 c93262d24..46126f82e 100644 --- a/cmd/helm/testdata/output/list.txt +++ b/cmd/helm/testdata/output/list.txt @@ -1,3 +1,3 @@ NAME NAMESPACE REVISION UPDATED STATUS CHART -starlord default 2 2016-01-16 00:00:00 +0000 UTC deployed chickadee-1.0.0 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 From b9a39e46dec137a826beb1e4f815c98ebbb22594 Mon Sep 17 00:00:00 2001 From: Abhilash Gnan Date: Tue, 2 Apr 2019 22:40:31 +0200 Subject: [PATCH 03/11] handle default list sort order through enum order Signed-off-by: Abhilash Gnan --- pkg/action/list.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/action/list.go b/pkg/action/list.go index 9e2e5258a..f423c2343 100644 --- a/pkg/action/list.go +++ b/pkg/action/list.go @@ -87,14 +87,14 @@ const ListAll = ListDeployed | ListUninstalled | ListUninstalling | ListPendingI type Sorter uint const ( - // ByDateAsc sorts by ascending dates (oldest updated release first) - ByDateAsc Sorter = iota - // ByDateDesc sorts by descending dates (latest updated release first) - ByDateDesc // ByNameAsc sorts by ascending lexicographic order - ByNameAsc + ByNameAsc Sorter = iota // ByNameDesc sorts by descending lexicographic order ByNameDesc + // ByDateAsc sorts by ascending dates (oldest updated release first) + ByDateAsc + // ByDateDesc sorts by descending dates (latest updated release first) + ByDateDesc ) // List is the action for listing releases. @@ -197,7 +197,6 @@ func (l *List) Run() ([]*release.Release, error) { // sort is an in-place sort where order is based on the value of a.Sort func (l *List) sort(rels []*release.Release) { - l.Sort = ByNameAsc if l.SortReverse { l.Sort = ByNameDesc } From 416667a8e950bd9b0daf459c19d5a3d651685725 Mon Sep 17 00:00:00 2001 From: Abhilash Gnan Date: Wed, 3 Apr 2019 19:58:57 +0200 Subject: [PATCH 04/11] Remove redundant ByNameAsc enum value. Handled by default sorting Signed-off-by: Abhilash Gnan --- pkg/action/list.go | 4 +--- pkg/action/list_test.go | 12 ------------ 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/pkg/action/list.go b/pkg/action/list.go index f423c2343..3494311f1 100644 --- a/pkg/action/list.go +++ b/pkg/action/list.go @@ -87,10 +87,8 @@ const ListAll = ListDeployed | ListUninstalled | ListUninstalling | ListPendingI type Sorter uint const ( - // ByNameAsc sorts by ascending lexicographic order - ByNameAsc Sorter = iota // ByNameDesc sorts by descending lexicographic order - ByNameDesc + ByNameDesc Sorter = iota + 1 // ByDateAsc sorts by ascending dates (oldest updated release first) ByDateAsc // ByDateDesc sorts by descending dates (latest updated release first) diff --git a/pkg/action/list_test.go b/pkg/action/list_test.go index cb62f0e43..430a7affc 100644 --- a/pkg/action/list_test.go +++ b/pkg/action/list_test.go @@ -103,13 +103,10 @@ func TestList_Limit(t *testing.T) { is := assert.New(t) lister := newListFixture(t) lister.Limit = 2 - // Sort because otherwise there is no guaranteed order - lister.Sort = ByNameAsc makeMeSomeReleases(lister.cfg.Releases, t) list, err := lister.Run() is.NoError(err) is.Len(list, 2) - // Lex order means one, three, two is.Equal("one", list[0].Name) is.Equal("three", list[1].Name) @@ -119,8 +116,6 @@ func TestList_BigLimit(t *testing.T) { is := assert.New(t) lister := newListFixture(t) lister.Limit = 20 - // Sort because otherwise there is no guaranteed order - lister.Sort = ByNameAsc makeMeSomeReleases(lister.cfg.Releases, t) list, err := lister.Run() is.NoError(err) @@ -137,8 +132,6 @@ func TestList_LimitOffset(t *testing.T) { lister := newListFixture(t) lister.Limit = 2 lister.Offset = 1 - // Sort because otherwise there is no guaranteed order - lister.Sort = ByNameAsc makeMeSomeReleases(lister.cfg.Releases, t) list, err := lister.Run() is.NoError(err) @@ -154,8 +147,6 @@ func TestList_LimitOffsetOutOfBounds(t *testing.T) { lister := newListFixture(t) lister.Limit = 2 lister.Offset = 3 // Last item is index 2 - // Sort because otherwise there is no guaranteed order - lister.Sort = ByNameAsc makeMeSomeReleases(lister.cfg.Releases, t) list, err := lister.Run() is.NoError(err) @@ -170,8 +161,6 @@ func TestList_LimitOffsetOutOfBounds(t *testing.T) { func TestList_StateMask(t *testing.T) { is := assert.New(t) lister := newListFixture(t) - // Sort because otherwise there is no guaranteed order - lister.Sort = ByNameAsc makeMeSomeReleases(lister.cfg.Releases, t) one, err := lister.cfg.Releases.Get("one", 1) is.NoError(err) @@ -200,7 +189,6 @@ func TestList_Filter(t *testing.T) { is := assert.New(t) lister := newListFixture(t) lister.Filter = "th." - lister.Sort = ByNameAsc makeMeSomeReleases(lister.cfg.Releases, t) res, err := lister.Run() From 20c4d29295f175037e4aa8ff94ee4493c23f8b90 Mon Sep 17 00:00:00 2001 From: Abhilash Gnan Date: Thu, 4 Apr 2019 20:58:06 +0200 Subject: [PATCH 05/11] fix docs for helm list Signed-off-by: Abhilash Gnan --- cmd/helm/list.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/helm/list.go b/cmd/helm/list.go index cd56cff79..839e733c3 100644 --- a/cmd/helm/list.go +++ b/cmd/helm/list.go @@ -87,7 +87,7 @@ func newListCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { f.BoolVarP(&client.Short, "short", "q", false, "output short (quiet) listing format") f.BoolVarP(&client.ByDate, "date", "d", false, "sort by release date") f.BoolVarP(&client.SortReverse, "reverse", "r", false, "reverse the sort order") - f.BoolVarP(&client.All, "all", "a", false, "show all releases, not just the ones marked deployed") + f.BoolVarP(&client.All, "all", "a", false, "show all releases, not just the ones marked deployed or failed") f.BoolVar(&client.Uninstalled, "uninstalled", false, "show uninstalled releases") f.BoolVar(&client.Superseded, "superseded", false, "show superseded releases") f.BoolVar(&client.Uninstalling, "uninstalling", false, "show releases that are currently being uninstalled") From 537872526b74c75cbfc99d11911a878c484ba0ef Mon Sep 17 00:00:00 2001 From: Abhilash Gnan Date: Thu, 4 Apr 2019 22:32:51 +0200 Subject: [PATCH 06/11] add more releases to list tests Signed-off-by: Abhilash Gnan --- cmd/helm/list_test.go | 34 +++++++++++++++++-- .../testdata/output/list-date-reversed.txt | 3 ++ cmd/helm/testdata/output/list.txt | 8 +++-- 3 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 cmd/helm/testdata/output/list-date-reversed.txt 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 From f019ec0e8d8cbcb97a294be13f553271501129cb Mon Sep 17 00:00:00 2001 From: Abhilash Gnan Date: Thu, 4 Apr 2019 23:57:03 +0200 Subject: [PATCH 07/11] add superseded to list filter mask Signed-off-by: Abhilash Gnan --- pkg/action/list.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/action/list.go b/pkg/action/list.go index 3494311f1..b42cc812c 100644 --- a/pkg/action/list.go +++ b/pkg/action/list.go @@ -241,6 +241,9 @@ func (l *List) SetStateMask() { if l.Failed { state |= ListFailed } + if l.Superseded { + state |= ListSuperseded + } // Apply a default if state == 0 { From f4c2b02cef95aecad6d691b812e4508fefb7ac6b Mon Sep 17 00:00:00 2001 From: Abhilash Gnan Date: Fri, 5 Apr 2019 00:08:44 +0200 Subject: [PATCH 08/11] remove unnecessary setting of list.All flag Signed-off-by: Abhilash Gnan --- cmd/helm/list.go | 1 - 1 file changed, 1 deletion(-) diff --git a/cmd/helm/list.go b/cmd/helm/list.go index 839e733c3..02000ca1d 100644 --- a/cmd/helm/list.go +++ b/cmd/helm/list.go @@ -66,7 +66,6 @@ func newListCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { if client.AllNamespaces { client.SetConfiguration(newActionConfig(true)) } - client.All = client.Limit == -1 client.SetStateMask() results, err := client.Run() From f7e2a78374283d94ffb5840e64f2cf222d31591a Mon Sep 17 00:00:00 2001 From: Abhilash Gnan Date: Fri, 5 Apr 2019 00:10:15 +0200 Subject: [PATCH 09/11] fix test cases for list.AllNamespaces Signed-off-by: Abhilash Gnan --- cmd/helm/list_test.go | 2 +- pkg/action/list_test.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/helm/list_test.go b/cmd/helm/list_test.go index e017265d6..8939119d8 100644 --- a/cmd/helm/list_test.go +++ b/cmd/helm/list_test.go @@ -65,7 +65,7 @@ func TestListCmd(t *testing.T) { Version: 1, Namespace: defaultNamespace, Info: &release.Info{ - LastDeployed: timestamp2, + LastDeployed: timestamp1, Status: release.StatusUninstalled, }, Chart: chartInfo, diff --git a/pkg/action/list_test.go b/pkg/action/list_test.go index 430a7affc..48e9a376a 100644 --- a/pkg/action/list_test.go +++ b/pkg/action/list_test.go @@ -81,6 +81,7 @@ func TestList_AllNamespaces(t *testing.T) { lister := newListFixture(t) makeMeSomeReleases(lister.cfg.Releases, t) lister.AllNamespaces = true + lister.SetStateMask() list, err := lister.Run() is.NoError(err) is.Len(list, 3) @@ -221,6 +222,11 @@ func makeMeSomeReleases(store *storage.Storage, t *testing.T) { three.Name = "three" three.Namespace = "default" three.Version = 3 + four := releaseStub() + four.Name = "four" + four.Namespace = "default" + four.Version = 4 + four.Info.Status = release.StatusSuperseded for _, rel := range []*release.Release{one, two, three} { if err := store.Create(rel); err != nil { From 7d3f85998bd7d18347825ca34944af9a8eeea4cf Mon Sep 17 00:00:00 2001 From: Abhilash Gnan Date: Fri, 5 Apr 2019 00:11:43 +0200 Subject: [PATCH 10/11] update list tests expected output files Signed-off-by: Abhilash Gnan --- cmd/helm/testdata/output/list-all.txt | 13 ++++++++++--- cmd/helm/testdata/output/list-date-reversed.txt | 8 +++++--- cmd/helm/testdata/output/list-date.txt | 8 +++++--- cmd/helm/testdata/output/list-failed.txt | 2 +- cmd/helm/testdata/output/list-filter.txt | 8 +++++--- cmd/helm/testdata/output/list-max.txt | 4 ++-- cmd/helm/testdata/output/list-offset.txt | 4 +++- cmd/helm/testdata/output/list-pending.txt | 2 +- cmd/helm/testdata/output/list-reverse.txt | 8 +++++--- cmd/helm/testdata/output/list-short.txt | 2 ++ cmd/helm/testdata/output/list-superseded.txt | 6 +++--- cmd/helm/testdata/output/list-uninstalling.txt | 2 +- 12 files changed, 43 insertions(+), 24 deletions(-) diff --git a/cmd/helm/testdata/output/list-all.txt b/cmd/helm/testdata/output/list-all.txt index 46126f82e..1872236fd 100644 --- a/cmd/helm/testdata/output/list-all.txt +++ b/cmd/helm/testdata/output/list-all.txt @@ -1,3 +1,10 @@ -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 +drax default 1 2016-01-16 00:00:01 +0000 UTC uninstalling chickadee-1.0.0 +gamora default 1 2016-01-16 00:00:01 +0000 UTC superseded chickadee-1.0.0 +groot default 1 2016-01-16 00:00:01 +0000 UTC uninstalled chickadee-1.0.0 +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 1 2016-01-16 00:00:01 +0000 UTC superseded chickadee-1.0.0 +starlord default 2 2016-01-16 00:00:01 +0000 UTC deployed chickadee-1.0.0 +thanos default 1 2016-01-16 00:00:01 +0000 UTC pending-install chickadee-1.0.0 diff --git a/cmd/helm/testdata/output/list-date-reversed.txt b/cmd/helm/testdata/output/list-date-reversed.txt index 46126f82e..5785d4d3f 100644 --- a/cmd/helm/testdata/output/list-date-reversed.txt +++ b/cmd/helm/testdata/output/list-date-reversed.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 +iguana default 2 2016-01-16 00:00:04 +0000 UTC deployed chickadee-1.0.0 +hummingbird default 1 2016-01-16 00:00:03 +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 diff --git a/cmd/helm/testdata/output/list-date.txt b/cmd/helm/testdata/output/list-date.txt index c93262d24..77c8132cd 100644 --- a/cmd/helm/testdata/output/list-date.txt +++ b/cmd/helm/testdata/output/list-date.txt @@ -1,3 +1,5 @@ -NAME NAMESPACE REVISION UPDATED STATUS CHART -starlord default 2 2016-01-16 00:00:00 +0000 UTC deployed chickadee-1.0.0 -rocket default 1 2016-01-16 00:00:01 +0000 UTC failed chickadee-1.0.0 +NAME NAMESPACE REVISION UPDATED STATUS CHART +starlord default 2 2016-01-16 00:00:01 +0000 UTC deployed chickadee-1.0.0 +rocket default 1 2016-01-16 00:00:02 +0000 UTC failed chickadee-1.0.0 +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 diff --git a/cmd/helm/testdata/output/list-failed.txt b/cmd/helm/testdata/output/list-failed.txt index f9e56e313..f87bbe18f 100644 --- a/cmd/helm/testdata/output/list-failed.txt +++ b/cmd/helm/testdata/output/list-failed.txt @@ -1,2 +1,2 @@ NAME NAMESPACE REVISION UPDATED STATUS CHART -rocket default 1 2016-01-16 00:00:01 +0000 UTC failed chickadee-1.0.0 +rocket default 1 2016-01-16 00:00:02 +0000 UTC failed chickadee-1.0.0 diff --git a/cmd/helm/testdata/output/list-filter.txt b/cmd/helm/testdata/output/list-filter.txt index 46126f82e..55a4ac8af 100644 --- a/cmd/helm/testdata/output/list-filter.txt +++ b/cmd/helm/testdata/output/list-filter.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 diff --git a/cmd/helm/testdata/output/list-max.txt b/cmd/helm/testdata/output/list-max.txt index f9e56e313..34f64136c 100644 --- a/cmd/helm/testdata/output/list-max.txt +++ b/cmd/helm/testdata/output/list-max.txt @@ -1,2 +1,2 @@ -NAME NAMESPACE REVISION UPDATED STATUS CHART -rocket default 1 2016-01-16 00:00:01 +0000 UTC failed 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 diff --git a/cmd/helm/testdata/output/list-offset.txt b/cmd/helm/testdata/output/list-offset.txt index 8d93a9a09..e97f020ab 100644 --- a/cmd/helm/testdata/output/list-offset.txt +++ b/cmd/helm/testdata/output/list-offset.txt @@ -1,2 +1,4 @@ NAME NAMESPACE REVISION UPDATED STATUS CHART -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 diff --git a/cmd/helm/testdata/output/list-pending.txt b/cmd/helm/testdata/output/list-pending.txt index 1a03b12dd..1cb7f8411 100644 --- a/cmd/helm/testdata/output/list-pending.txt +++ b/cmd/helm/testdata/output/list-pending.txt @@ -1,2 +1,2 @@ NAME NAMESPACE REVISION UPDATED STATUS CHART -thanos default 1 2016-01-16 00:00:00 +0000 UTC pending-install chickadee-1.0.0 +thanos default 1 2016-01-16 00:00:01 +0000 UTC pending-install chickadee-1.0.0 diff --git a/cmd/helm/testdata/output/list-reverse.txt b/cmd/helm/testdata/output/list-reverse.txt index c93262d24..7df0baadb 100644 --- a/cmd/helm/testdata/output/list-reverse.txt +++ b/cmd/helm/testdata/output/list-reverse.txt @@ -1,3 +1,5 @@ -NAME NAMESPACE REVISION UPDATED STATUS CHART -starlord default 2 2016-01-16 00:00:00 +0000 UTC deployed chickadee-1.0.0 -rocket default 1 2016-01-16 00:00:01 +0000 UTC failed chickadee-1.0.0 +NAME NAMESPACE REVISION UPDATED STATUS CHART +starlord default 2 2016-01-16 00:00:01 +0000 UTC deployed chickadee-1.0.0 +rocket default 1 2016-01-16 00:00:02 +0000 UTC failed chickadee-1.0.0 +iguana default 2 2016-01-16 00:00:04 +0000 UTC deployed chickadee-1.0.0 +hummingbird default 1 2016-01-16 00:00:03 +0000 UTC deployed chickadee-1.0.0 diff --git a/cmd/helm/testdata/output/list-short.txt b/cmd/helm/testdata/output/list-short.txt index 33d328424..0a63be990 100644 --- a/cmd/helm/testdata/output/list-short.txt +++ b/cmd/helm/testdata/output/list-short.txt @@ -1,2 +1,4 @@ +hummingbird +iguana rocket starlord diff --git a/cmd/helm/testdata/output/list-superseded.txt b/cmd/helm/testdata/output/list-superseded.txt index 46126f82e..e83a8b797 100644 --- a/cmd/helm/testdata/output/list-superseded.txt +++ b/cmd/helm/testdata/output/list-superseded.txt @@ -1,3 +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 +NAME NAMESPACE REVISION UPDATED STATUS CHART +gamora default 1 2016-01-16 00:00:01 +0000 UTC superseded chickadee-1.0.0 +starlord default 1 2016-01-16 00:00:01 +0000 UTC superseded chickadee-1.0.0 diff --git a/cmd/helm/testdata/output/list-uninstalling.txt b/cmd/helm/testdata/output/list-uninstalling.txt index 99c634c11..a90771361 100644 --- a/cmd/helm/testdata/output/list-uninstalling.txt +++ b/cmd/helm/testdata/output/list-uninstalling.txt @@ -1,2 +1,2 @@ NAME NAMESPACE REVISION UPDATED STATUS CHART -drax default 1 2016-01-16 00:00:00 +0000 UTC uninstalling chickadee-1.0.0 +drax default 1 2016-01-16 00:00:01 +0000 UTC uninstalling chickadee-1.0.0 From d40f3c63ea497f6359f86d294d2ab2dc57a0d4fd Mon Sep 17 00:00:00 2001 From: Abhilash Gnan Date: Mon, 8 Apr 2019 20:40:01 +0200 Subject: [PATCH 11/11] fix ByDate sorter to use Time.Unix() Signed-off-by: Abhilash Gnan --- pkg/releaseutil/sorter.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/releaseutil/sorter.go b/pkg/releaseutil/sorter.go index 35506f268..f500aeea3 100644 --- a/pkg/releaseutil/sorter.go +++ b/pkg/releaseutil/sorter.go @@ -38,8 +38,8 @@ type ByDate struct{ list } // Less compares to releases func (s ByDate) Less(i, j int) bool { - ti := s.list[i].Info.LastDeployed.Second() - tj := s.list[j].Info.LastDeployed.Second() + ti := s.list[i].Info.LastDeployed.Unix() + tj := s.list[j].Info.LastDeployed.Unix() return ti < tj }