-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kubernetes Version Server Check For Kudo Install (#836)
* adding install kubernete version validation as a minVersion * kubernetesVersion is now a required field for operators
- Loading branch information
Showing
8 changed files
with
175 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package version | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/magiconair/properties/assert" | ||
) | ||
|
||
func Test_validVersion(t *testing.T) { | ||
|
||
tests := []struct { | ||
name string | ||
actual *Version | ||
expected *Version | ||
val int | ||
}{ | ||
{"expect early version", MustParse("1.5"), MustParse("1.4"), -1}, | ||
{"expect same version", MustParse("1.5"), MustParse("1.5"), 0}, | ||
{"expect newer version", MustParse("1.5"), MustParse("1.6"), 1}, | ||
{"full semver is not a factor", MustParse("1.5.8"), MustParse("1.5.0"), 0}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
val := tt.expected.CompareMajorMinor(tt.actual) | ||
assert.Equal(t, tt.val, val) | ||
}) | ||
} | ||
} | ||
|
||
func TestClean(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
actual string | ||
expected string | ||
}{ | ||
{"clean ver", "1.0.0", "1.0.0"}, | ||
{"clean ver", "v1.0.0", "1.0.0"}, | ||
{"short ver", "v1.0", "1.0"}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
result := Clean(tt.actual) | ||
assert.Equal(t, result, tt.expected) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters