address lavalamp's comment on using testapi instead of latest, and adding comments for public method.

This commit is contained in:
Chao Xu 2015-09-12 15:43:33 -07:00
parent f5023929d8
commit ca803fc504
4 changed files with 7 additions and 2 deletions

View File

@ -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)

View File

@ -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 {

View File

@ -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)

View File

@ -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()