mirror of https://github.com/k3s-io/k3s
Merge pull request #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 ```pull/6/head
commit
22e6bd4c8d
|
@ -61,3 +61,33 @@ func TestGetGroup(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetGroupVersion(t *testing.T) {
|
||||
testCases := []struct {
|
||||
group string
|
||||
version string
|
||||
output string
|
||||
}{
|
||||
{
|
||||
"",
|
||||
"v1",
|
||||
"v1",
|
||||
},
|
||||
{
|
||||
"extensions",
|
||||
"",
|
||||
"extensions/",
|
||||
},
|
||||
{
|
||||
"extensions",
|
||||
"v1beta1",
|
||||
"extensions/v1beta1",
|
||||
},
|
||||
}
|
||||
for _, test := range testCases {
|
||||
actual := GetGroupVersion(test.group, test.version)
|
||||
if test.output != actual {
|
||||
t.Errorf("expect version: %s, got: %s\n", test.output, actual)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue