Commit ca803fc5 authored by Chao Xu's avatar Chao Xu

address lavalamp's comment on using testapi instead of latest, and adding…

address lavalamp's comment on using testapi instead of latest, and adding comments for public method.
parent f5023929
...@@ -46,6 +46,8 @@ func TestResourceVersioner(t *testing.T) { ...@@ -46,6 +46,8 @@ func TestResourceVersioner(t *testing.T) {
func TestCodec(t *testing.T) { func TestCodec(t *testing.T) {
pod := internal.Pod{} 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) data, err := latest.GroupOrDie("").Codec.Encode(&pod)
if err != nil { if err != nil {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)
......
...@@ -67,6 +67,8 @@ func IsRegisteredAPIVersion(version string) bool { ...@@ -67,6 +67,8 @@ func IsRegisteredAPIVersion(version string) bool {
return false return false
} }
// GroupVersionsForGroup returns the registered versions of a group in the form
// of "group/version".
func GroupVersionsForGroup(group string) []string { func GroupVersionsForGroup(group string) []string {
ret := []string{} ret := []string{}
for _, v := range RegisteredVersions { for _, v := range RegisteredVersions {
......
...@@ -47,6 +47,8 @@ func TestResourceVersioner(t *testing.T) { ...@@ -47,6 +47,8 @@ func TestResourceVersioner(t *testing.T) {
func TestCodec(t *testing.T) { func TestCodec(t *testing.T) {
daemonSet := experimental.DaemonSet{} 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) data, err := latest.GroupOrDie("experimental").Codec.Encode(&daemonSet)
if err != nil { if err != nil {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)
......
...@@ -24,7 +24,6 @@ import ( ...@@ -24,7 +24,6 @@ import (
"time" "time"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/latest"
"k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/client/cache" "k8s.io/kubernetes/pkg/client/cache"
client "k8s.io/kubernetes/pkg/client/unversioned" client "k8s.io/kubernetes/pkg/client/unversioned"
...@@ -143,7 +142,7 @@ func TestDefaultErrorFunc(t *testing.T) { ...@@ -143,7 +142,7 @@ func TestDefaultErrorFunc(t *testing.T) {
} }
handler := util.FakeHandler{ handler := util.FakeHandler{
StatusCode: 200, StatusCode: 200,
ResponseBody: runtime.EncodeOrDie(latest.GroupOrDie("").Codec, testPod), ResponseBody: runtime.EncodeOrDie(testapi.Default.Codec(), testPod),
T: t, T: t,
} }
mux := http.NewServeMux() mux := http.NewServeMux()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment