fix sort byNamespace test

Signed-off-by: Abhilash Gnan <abhilashgnan@gmail.com>
pull/5704/head
Abhilash Gnan 6 years ago
parent 996c329828
commit 2743020db5

@ -28,13 +28,13 @@ import (
// note: this test data is shared with filter_test.go.
var releases = []*rspb.Release{
tsRelease("quiet-bear", 2, 2000, rspb.Status_SUPERSEDED),
tsRelease("angry-bird", 4, 3000, rspb.Status_DEPLOYED),
tsRelease("happy-cats", 1, 4000, rspb.Status_DELETED),
tsRelease("vocal-dogs", 3, 6000, rspb.Status_DELETED),
tsRelease("quiet-bear", 2, 2000, rspb.Status_SUPERSEDED, "default"),
tsRelease("angry-bird", 4, 3000, rspb.Status_DEPLOYED, "abc"),
tsRelease("happy-cats", 1, 4000, rspb.Status_DELETED, "def"),
tsRelease("vocal-dogs", 3, 6000, rspb.Status_DELETED, "cde"),
}
func tsRelease(name string, vers int32, dur time.Duration, code rspb.Status_Code) *rspb.Release {
func tsRelease(name string, vers int32, dur time.Duration, code rspb.Status_Code, namespace string) *rspb.Release {
tmsp := timeconv.Timestamp(time.Now().Add(time.Duration(dur)))
info := &rspb.Info{Status: &rspb.Status{Code: code}, LastDeployed: tmsp}
return &rspb.Release{
@ -46,6 +46,7 @@ func tsRelease(name string, vers int32, dur time.Duration, code rspb.Status_Code
Name: name,
},
},
Namespace: namespace,
}
}
@ -96,3 +97,13 @@ func TestSortByChartName(t *testing.T) {
return ni < nj
})
}
func TestSortByNamespace(t *testing.T) {
SortByNamespace(releases)
check(t, "ByNamespace", func(i, j int) bool {
ni := releases[i].Namespace
nj := releases[j].Namespace
return ni < nj
})
}

Loading…
Cancel
Save