Skip to content

Commit

Permalink
Add support for upcoming distribution versions
Browse files Browse the repository at this point in the history
  • Loading branch information
alessiodionisi committed Nov 15, 2024
1 parent 7eeaf3e commit f03bb1c
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 15 deletions.
51 changes: 42 additions & 9 deletions internal/distribution/compatibility.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (c *EKSClusterCheck) IsCompatible() bool {
return false
}

max12EightVersion, err := semver.NewVersion("v1.28.4")
max12EightVersion, err := semver.NewVersion("v1.28.5")
if err != nil {
return false
}
Expand All @@ -105,7 +105,17 @@ func (c *EKSClusterCheck) IsCompatible() bool {
return false
}

max12NineVersion, err := semver.NewVersion("v1.29.4")
max12NineVersion, err := semver.NewVersion("v1.29.5")
if err != nil {
return false
}

min130Version, err := semver.NewVersion("v1.30.0")
if err != nil {
return false
}

max130Version, err := semver.NewVersion("v1.30.0")
if err != nil {
return false
}
Expand All @@ -114,7 +124,8 @@ func (c *EKSClusterCheck) IsCompatible() bool {
(currentVersion.GreaterThanOrEqual(min126Version) && currentVersion.LessThanOrEqual(max126Version)) ||
(currentVersion.GreaterThanOrEqual(min12SevenVersion) && currentVersion.LessThanOrEqual(max12SevenVersion)) ||
(currentVersion.GreaterThanOrEqual(min12EightVersion)) && currentVersion.LessThanOrEqual(max12EightVersion) ||
(currentVersion.GreaterThanOrEqual(min12NineVersion)) && currentVersion.LessThanOrEqual(max12NineVersion)
(currentVersion.GreaterThanOrEqual(min12NineVersion)) && currentVersion.LessThanOrEqual(max12NineVersion) ||
(currentVersion.GreaterThanOrEqual(min130Version)) && currentVersion.LessThanOrEqual(max130Version)
}

type KFDDistributionCheck struct {
Expand Down Expand Up @@ -168,7 +179,7 @@ func (c *KFDDistributionCheck) IsCompatible() bool {
return false
}

max12EightVersion, err := semver.NewVersion("v1.28.4")
max12EightVersion, err := semver.NewVersion("v1.28.5")
if err != nil {
return false
}
Expand All @@ -178,7 +189,17 @@ func (c *KFDDistributionCheck) IsCompatible() bool {
return false
}

max12NineVersion, err := semver.NewVersion("v1.29.4")
max12NineVersion, err := semver.NewVersion("v1.29.5")
if err != nil {
return false
}

min130Version, err := semver.NewVersion("v1.30.0")
if err != nil {
return false
}

max130Version, err := semver.NewVersion("v1.30.0")
if err != nil {
return false
}
Expand All @@ -187,7 +208,8 @@ func (c *KFDDistributionCheck) IsCompatible() bool {
(currentVersion.GreaterThanOrEqual(min126Version) && currentVersion.LessThanOrEqual(max126Version)) ||
(currentVersion.GreaterThanOrEqual(min12SevenVersion) && currentVersion.LessThanOrEqual(max12SevenVersion)) ||
(currentVersion.GreaterThanOrEqual(min12EightVersion)) && currentVersion.LessThanOrEqual(max12EightVersion) ||
(currentVersion.GreaterThanOrEqual(min12NineVersion)) && currentVersion.LessThanOrEqual(max12NineVersion)
(currentVersion.GreaterThanOrEqual(min12NineVersion)) && currentVersion.LessThanOrEqual(max12NineVersion) ||
(currentVersion.GreaterThanOrEqual(min130Version)) && currentVersion.LessThanOrEqual(max130Version)
}

type OnPremisesCheck struct {
Expand Down Expand Up @@ -241,7 +263,7 @@ func (c *OnPremisesCheck) IsCompatible() bool {
return false
}

max12EightVersion, err := semver.NewVersion("v1.28.4")
max12EightVersion, err := semver.NewVersion("v1.28.5")
if err != nil {
return false
}
Expand All @@ -251,7 +273,17 @@ func (c *OnPremisesCheck) IsCompatible() bool {
return false
}

max12NineVersion, err := semver.NewVersion("v1.29.4")
max12NineVersion, err := semver.NewVersion("v1.29.5")
if err != nil {
return false
}

min130Version, err := semver.NewVersion("v1.30.0")
if err != nil {
return false
}

max130Version, err := semver.NewVersion("v1.30.0")
if err != nil {
return false
}
Expand All @@ -260,5 +292,6 @@ func (c *OnPremisesCheck) IsCompatible() bool {
(currentVersion.GreaterThanOrEqual(min126Version) && currentVersion.LessThanOrEqual(max126Version)) ||
(currentVersion.GreaterThanOrEqual(min12SevenVersion) && currentVersion.LessThanOrEqual(max12SevenVersion)) ||
(currentVersion.GreaterThanOrEqual(min12EightVersion)) && currentVersion.LessThanOrEqual(max12EightVersion) ||
(currentVersion.GreaterThanOrEqual(min12NineVersion)) && currentVersion.LessThanOrEqual(max12NineVersion)
(currentVersion.GreaterThanOrEqual(min12NineVersion)) && currentVersion.LessThanOrEqual(max12NineVersion) ||
(currentVersion.GreaterThanOrEqual(min130Version)) && currentVersion.LessThanOrEqual(max130Version)
}
22 changes: 16 additions & 6 deletions internal/distribution/compatibility_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,33 @@ func TestEKSClusterCheckIsCompatible(t *testing.T) {
expected: false,
},
{
name: "should return true if distribution version is greater than 1.28.0 and less than 1.28.4",
name: "should return true if distribution version is greater than 1.28.0 and less than 1.28.5",
distributionVersion: "v1.28.3",
expected: true,
},
{
name: "should return false if distribution version is greater than 1.28.4",
distributionVersion: "v1.28.5",
name: "should return false if distribution version is greater than 1.28.5",
distributionVersion: "v1.28.6",
expected: false,
},
{
name: "should return true if distribution version is greater than 1.29.0 and less than 1.29.4",
name: "should return true if distribution version is greater than 1.29.0 and less than 1.29.5",
distributionVersion: "v1.29.3",
expected: true,
},
{
name: "should return false if distribution version is greater than 1.29.4",
distributionVersion: "v1.29.5",
name: "should return false if distribution version is greater than 1.29.5",
distributionVersion: "v1.29.6",
expected: false,
},
{
name: "should return true if distribution version is greater than 1.30.0 and less than 1.30.0",
distributionVersion: "v1.30.0",
expected: true,
},
{
name: "should return false if distribution version is greater than 1.30.1",
distributionVersion: "v1.30.1",
expected: false,
},
}
Expand Down

0 comments on commit f03bb1c

Please sign in to comment.