Skip to content

Commit bd0ebc9

Browse files
author
tanshanshan
committed
add unit test for groupversion
1 parent 12a8038 commit bd0ebc9

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)