Browse code

Match changes to make []runtime.Object cleaner

Clayton Coleman authored on 2015/04/29 11:33:03
Showing 4 changed files
... ...
@@ -79,6 +79,7 @@ func ValidateObject(obj runtime.Object) (errors []error) {
79 79
 		errors = templatev.ValidateTemplate(t)
80 80
 	default:
81 81
 		if list, err := runtime.ExtractList(obj); err == nil {
82
+			runtime.DecodeList(list, kapi.Scheme)
82 83
 			for i := range list {
83 84
 				errs := ValidateObject(list[i])
84 85
 				errors = append(errors, errs...)
... ...
@@ -12,8 +12,8 @@ import (
12 12
 )
13 13
 
14 14
 func TestNewClient(t *testing.T) {
15
-	o := testclient.NewObjects(kapi.Scheme)
16
-	if err := testclient.AddObjectsFromPath("../../../test/integration/fixtures/test-deployment-config.json", o); err != nil {
15
+	o := testclient.NewObjects(kapi.Scheme, kapi.Scheme)
16
+	if err := testclient.AddObjectsFromPath("../../../test/integration/fixtures/test-deployment-config.json", o, kapi.Scheme); err != nil {
17 17
 		t.Fatal(err)
18 18
 	}
19 19
 	osc, _ := NewFixtureClients(o)
... ...
@@ -37,7 +37,7 @@ func TestNewClient(t *testing.T) {
37 37
 }
38 38
 
39 39
 func TestErrors(t *testing.T) {
40
-	o := testclient.NewObjects(kapi.Scheme)
40
+	o := testclient.NewObjects(kapi.Scheme, kapi.Scheme)
41 41
 	o.Add(&kapi.List{
42 42
 		Items: []runtime.Object{
43 43
 			&(errors.NewNotFound("DeploymentConfigList", "").(*errors.StatusError).ErrStatus),
... ...
@@ -148,9 +148,9 @@ func TestProjectStatus(t *testing.T) {
148 148
 			}
149 149
 			return time.Now()
150 150
 		}
151
-		o := ktestclient.NewObjects(kapi.Scheme)
151
+		o := ktestclient.NewObjects(kapi.Scheme, kapi.Scheme)
152 152
 		if len(test.Path) > 0 {
153
-			if err := ktestclient.AddObjectsFromPath(test.Path, o); err != nil {
153
+			if err := ktestclient.AddObjectsFromPath(test.Path, o, kapi.Scheme); err != nil {
154 154
 				t.Fatal(err)
155 155
 			}
156 156
 		}
... ...
@@ -13,6 +13,7 @@ import (
13 13
 	"github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl"
14 14
 	kcmdutil "github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd/util"
15 15
 	"github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/resource"
16
+	"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
16 17
 	utilerrors "github.com/GoogleCloudPlatform/kubernetes/pkg/util/errors"
17 18
 
18 19
 	"github.com/GoogleCloudPlatform/kubernetes/pkg/tools"
... ...
@@ -138,6 +139,7 @@ func OverwriteBootstrapPolicy(etcdHelper tools.EtcdHelper, masterNamespace, poli
138 138
 		if !ok {
139 139
 			return errors.New("policy must be contained in a template.  One can be created with '" + createBootstrapPolicyCommand + "'.")
140 140
 		}
141
+		runtime.DecodeList(template.Objects, kapi.Scheme)
141 142
 
142 143
 		for _, item := range template.Objects {
143 144
 			switch t := item.(type) {