Skip to content

Commit

Permalink
test(upgrades): skip versions if does not have release date (#10574)
Browse files Browse the repository at this point in the history
Signed-off-by: slonka <slonka@users.noreply.github.com>
  • Loading branch information
slonka authored Jun 20, 2024
1 parent 098c42c commit 38165c2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions test/framework/versions/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type Version struct {
Version string `json:"version"`
Lts bool `json:"lts,omitempty"`
EndOfLifeDate string `json:"endOfLifeDate"`
ReleaseDate string `json:"releaseDate"`
SemVer *semver.Version
}

Expand Down Expand Up @@ -55,6 +56,9 @@ func UpgradableVersions(versions []Version, currentVersion semver.Version) []str
}
var res []string
for _, version := range versions {
if version.ReleaseDate == "" {
continue
}
if version.EndOfLifeDate != "" {
eol, err := time.Parse(time.DateOnly, version.EndOfLifeDate)
if err != nil {
Expand Down
11 changes: 6 additions & 5 deletions test/framework/versions/versions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ var _ = Describe("versions", func() {
DescribeTable("should return the list of versions that can be upgraded to the latest", func(currentStr string, expectedVersions []string) {
// given
vers := []versions.Version{
{SemVer: semver.MustParse("1.1.1")},
{SemVer: semver.MustParse("1.2.3"), Lts: true, EndOfLifeDate: "2100-01-01"},
{SemVer: semver.MustParse("1.3.1")},
{SemVer: semver.MustParse("1.4.2")},
{SemVer: semver.MustParse("1.5.8")},
{SemVer: semver.MustParse("1.1.1"), ReleaseDate: "2024-02-01"},
{SemVer: semver.MustParse("1.2.3"), Lts: true, EndOfLifeDate: "2100-01-01", ReleaseDate: "2024-03-01"},
{SemVer: semver.MustParse("1.3.1"), ReleaseDate: "2024-04-01"},
{SemVer: semver.MustParse("1.4.2"), ReleaseDate: "2024-05-01"},
{SemVer: semver.MustParse("1.5.8"), ReleaseDate: "2024-06-01"},
{SemVer: semver.MustParse("1.5.9")},
}
// when
current := semver.MustParse(currentStr)
Expand Down

0 comments on commit 38165c2

Please sign in to comment.