From ca803fc504d93d31b27c5e7b06e00994bc0f4cdf Mon Sep 17 00:00:00 2001 From: Chao Xu Date: Sat, 12 Sep 2015 15:43:33 -0700 Subject: [PATCH] address lavalamp's comment on using testapi instead of latest, and adding comments for public method. --- pkg/api/install/install_test.go | 2 ++ pkg/api/registered/registered.go | 2 ++ pkg/apis/experimental/install/install_test.go | 2 ++ plugin/pkg/scheduler/factory/factory_test.go | 3 +-- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/api/install/install_test.go b/pkg/api/install/install_test.go index fa731fe4f6c..e2c59ce8b09 100644 --- a/pkg/api/install/install_test.go +++ b/pkg/api/install/install_test.go @@ -46,6 +46,8 @@ func TestResourceVersioner(t *testing.T) { func TestCodec(t *testing.T) { pod := internal.Pod{} + // We do want to use package latest rather than testapi here, because we + // want to test if the package install and package latest work as expected. data, err := latest.GroupOrDie("").Codec.Encode(&pod) if err != nil { t.Fatalf("unexpected error: %v", err) diff --git a/pkg/api/registered/registered.go b/pkg/api/registered/registered.go index 9a3ef47bcb7..c1601c2af4c 100644 --- a/pkg/api/registered/registered.go +++ b/pkg/api/registered/registered.go @@ -67,6 +67,8 @@ func IsRegisteredAPIVersion(version string) bool { return false } +// GroupVersionsForGroup returns the registered versions of a group in the form +// of "group/version". func GroupVersionsForGroup(group string) []string { ret := []string{} for _, v := range RegisteredVersions { diff --git a/pkg/apis/experimental/install/install_test.go b/pkg/apis/experimental/install/install_test.go index 37e156b82cb..cbb5132a8c4 100644 --- a/pkg/apis/experimental/install/install_test.go +++ b/pkg/apis/experimental/install/install_test.go @@ -47,6 +47,8 @@ func TestResourceVersioner(t *testing.T) { func TestCodec(t *testing.T) { daemonSet := experimental.DaemonSet{} + // We do want to use package latest rather than testapi here, because we + // want to test if the package install and package latest work as expected. data, err := latest.GroupOrDie("experimental").Codec.Encode(&daemonSet) if err != nil { t.Fatalf("unexpected error: %v", err) diff --git a/plugin/pkg/scheduler/factory/factory_test.go b/plugin/pkg/scheduler/factory/factory_test.go index 7dac3e0fe38..a4ba4498cb9 100644 --- a/plugin/pkg/scheduler/factory/factory_test.go +++ b/plugin/pkg/scheduler/factory/factory_test.go @@ -24,7 +24,6 @@ import ( "time" "k8s.io/kubernetes/pkg/api" - "k8s.io/kubernetes/pkg/api/latest" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/client/cache" client "k8s.io/kubernetes/pkg/client/unversioned" @@ -143,7 +142,7 @@ func TestDefaultErrorFunc(t *testing.T) { } handler := util.FakeHandler{ StatusCode: 200, - ResponseBody: runtime.EncodeOrDie(latest.GroupOrDie("").Codec, testPod), + ResponseBody: runtime.EncodeOrDie(testapi.Default.Codec(), testPod), T: t, } mux := http.NewServeMux()