Skip to content

Commit

Permalink
Merge pull request #9112 from Hellcatlk/UnitTestCase
Browse files Browse the repository at this point in the history
Add unit test case for pkg/k8sversion/version_test.go
  • Loading branch information
k8s-ci-robot authored May 22, 2020
2 parents 553a081 + 41a216a commit 212ac0a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/k8sversion/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ func TestParse(t *testing.T) {
Input string
Expected string
}{
{Input: "", Expected: "unable to parse kubernetes version \"\""},
{Input: "abc", Expected: "unable to parse kubernetes version \"abc\""},
{Input: "1.1.0", Expected: "1.1.0"},
{Input: "1.2.0", Expected: "1.2.0"},
{Input: "1.3.0", Expected: "1.3.0"},
Expand All @@ -48,7 +50,9 @@ func TestParse(t *testing.T) {
for _, g := range grid {
actual, err := Parse(g.Input)
if err != nil {
t.Errorf("error parsing %q: %v", g.Input, err)
if err.Error() != g.Expected {
t.Errorf("error parsing %q: %v", g.Input, err)
}
continue
}
if actual.String() != g.Expected {
Expand Down

0 comments on commit 212ac0a

Please sign in to comment.