Merge pull request #5767 from steven-zou/add_latest_version

Append latest version of the chart when returning the chart list
This commit is contained in:
Wenkai Yin 2018-08-30 16:37:44 +08:00 committed by GitHub
commit 7564214946
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -46,6 +46,7 @@ type DigitalSignature struct {
type ChartInfo struct {
Name string
TotalVersions uint32 `json:"total_versions"`
LatestVersion string `json:"latest_version"`
Created time.Time
Updated time.Time
Icon string
@ -134,6 +135,7 @@ func (cho *ChartOperator) GetChartList(content []byte) ([]*ChartInfo, error) {
chartInfo.Home = lVersion.Home
chartInfo.Icon = lVersion.Icon
chartInfo.Deprecated = lVersion.Deprecated
chartInfo.LatestVersion = lVersion.GetVersion()
chartList = append(chartList, chartInfo)
}
}

View File

@ -39,4 +39,8 @@ func TestGetChartList(t *testing.T) {
if firstInSortedList.Name != "harbor" {
t.Fatalf("Expect the fist item of the sorted list to be 'harbor' but got '%s'", firstInSortedList.Name)
}
if firstInSortedList.LatestVersion != "0.2.0" {
t.Fatalf("Expect latest version '0.2.0' but got '%s'", firstInSortedList.LatestVersion)
}
}