-
-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Richard Gee <[email protected]>
- Loading branch information
Showing
4 changed files
with
64 additions
and
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package chart | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func Test_tagIsUpgradable(t *testing.T) { | ||
tests := []struct { | ||
title string | ||
current string | ||
latest string | ||
expected bool | ||
}{ | ||
{ | ||
title: "Upgradeable", | ||
current: "1.0.0", | ||
latest: "1.1.0", | ||
expected: true, | ||
}, | ||
{ | ||
title: "Same version", | ||
current: "1.0.0", | ||
latest: "1.0.0", | ||
expected: false, | ||
}, | ||
{ | ||
title: "latest is RC", | ||
current: "1.0.0", | ||
latest: "1.0.0-RC", | ||
expected: false, | ||
}, | ||
{ | ||
title: "latest is rc", | ||
current: "1.0.0", | ||
latest: "1.0.0-rc", | ||
expected: false, | ||
}, | ||
{ | ||
title: "current is 'latest'", | ||
current: "latest", | ||
latest: "1.0.0", | ||
expected: false, | ||
}, | ||
} | ||
|
||
for _, tc := range tests { | ||
|
||
t.Run(tc.title, func(t *testing.T) { | ||
|
||
upgradeableRes := tagIsUpgradeable(tc.current, tc.latest) | ||
|
||
if upgradeableRes != tc.expected { | ||
t.Fatalf("want: %t\n got: %t\n", tc.expected, upgradeableRes) | ||
} | ||
}) | ||
} | ||
} |
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