Update tests to handle codec changes

This commit is contained in:
Clayton Coleman
2016-01-22 00:06:52 -05:00
parent 2fd38a7dc0
commit 33085c0cf2
34 changed files with 147 additions and 181 deletions

View File

@@ -20,6 +20,7 @@ import (
"reflect"
"testing"
"k8s.io/kubernetes/pkg/runtime"
schedulerapi "k8s.io/kubernetes/plugin/pkg/scheduler/api"
latestschedulerapi "k8s.io/kubernetes/plugin/pkg/scheduler/api/latest"
"k8s.io/kubernetes/plugin/pkg/scheduler/factory"
@@ -92,16 +93,14 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
for v, tc := range schedulerFiles {
policy := schedulerapi.Policy{}
err := latestschedulerapi.Codec.DecodeInto([]byte(tc.JSON), &policy)
if err != nil {
if err := runtime.DecodeInto(latestschedulerapi.Codec, []byte(tc.JSON), &policy); err != nil {
t.Errorf("%s: Error decoding: %v", v, err)
continue
}
if !reflect.DeepEqual(policy, tc.ExpectedPolicy) {
t.Errorf("%s: Expected:\n\t%#v\nGot:\n\t%#v", v, tc.ExpectedPolicy, policy)
}
_, err = factory.NewConfigFactory(nil, "some-scheduler-name").CreateFromConfig(policy)
if err != nil {
if _, err := factory.NewConfigFactory(nil, "some-scheduler-name").CreateFromConfig(policy); err != nil {
t.Errorf("%s: Error constructing: %v", v, err)
continue
}