Skip to content

Commit 22e6bd4

Browse files
author
Kubernetes Submit Queue
authored
Merge pull request kubernetes#40915 from tanshanshan/api-groupversion-unittest
Automatic merge from submit-queue Improve code coverage for pkg/api/util **What this PR does / why we need it**: Improve code coverage for pkg/api/util . Thanks. **Special notes for your reviewer**: **Release note**: ```release-note ```
2 parents 1aa0606 + bd0ebc9 commit 22e6bd4

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

pkg/api/util/group_version_test.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,33 @@ func TestGetGroup(t *testing.T) {
6161
}
6262
}
6363
}
64+
65+
func TestGetGroupVersion(t *testing.T) {
66+
testCases := []struct {
67+
group string
68+
version string
69+
output string
70+
}{
71+
{
72+
"",
73+
"v1",
74+
"v1",
75+
},
76+
{
77+
"extensions",
78+
"",
79+
"extensions/",
80+
},
81+
{
82+
"extensions",
83+
"v1beta1",
84+
"extensions/v1beta1",
85+
},
86+
}
87+
for _, test := range testCases {
88+
actual := GetGroupVersion(test.group, test.version)
89+
if test.output != actual {
90+
t.Errorf("expect version: %s, got: %s\n", test.output, actual)
91+
}
92+
}
93+
}

0 commit comments

Comments
 (0)