From bd0ebc9dbab03efe6b01e749c141eb2d2eb8f2e3 Mon Sep 17 00:00:00 2001 From: tanshanshan Date: Fri, 3 Feb 2017 17:37:42 +0800 Subject: [PATCH] add unit test for groupversion --- pkg/api/util/group_version_test.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/pkg/api/util/group_version_test.go b/pkg/api/util/group_version_test.go index a7d4e124391..5975305a26a 100644 --- a/pkg/api/util/group_version_test.go +++ b/pkg/api/util/group_version_test.go @@ -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) + } + } +}