Remaining codec change refactors

This commit is contained in:
Clayton Coleman
2016-01-22 00:11:30 -05:00
parent 33085c0cf2
commit 4a6935b31f
23 changed files with 104 additions and 82 deletions

View File

@@ -24,6 +24,7 @@ import (
"github.com/pborman/uuid"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apimachinery/registered"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util/io"
"k8s.io/kubernetes/pkg/volume"
)
@@ -32,8 +33,9 @@ func TestSavePodToFile(t *testing.T) {
pod := volume.NewPersistentVolumeRecyclerPodTemplate()
// sets all default values on a pod for equality comparison after decoding from file
encoded, err := registered.GroupOrDie(api.GroupName).Codec.Encode(pod)
registered.GroupOrDie(api.GroupName).Codec.DecodeInto(encoded, pod)
codec := api.Codecs.LegacyCodec(registered.GroupOrDie(api.GroupName).GroupVersion)
encoded, err := runtime.Encode(codec, pod)
runtime.DecodeInto(codec, encoded, pod)
path := fmt.Sprintf("/tmp/kube-io-test-%s", uuid.New())
defer os.Remove(path)