mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-10 05:30:26 +00:00
Rename JSONBase -> TypeMeta in preparation for v1beta3
Will make subsequent refactor much easier
This commit is contained in:
@@ -59,7 +59,7 @@ func (rs *REST) Create(ctx api.Context, obj runtime.Object) (<-chan runtime.Obje
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("not a replication controller: %#v", obj)
|
||||
}
|
||||
if !api.ValidNamespace(ctx, &controller.JSONBase) {
|
||||
if !api.ValidNamespace(ctx, &controller.TypeMeta) {
|
||||
return nil, errors.NewConflict("controller", controller.Namespace, fmt.Errorf("Controller.Namespace does not match the provided context"))
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ func (rs *REST) Update(ctx api.Context, obj runtime.Object) (<-chan runtime.Obje
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("not a replication controller: %#v", obj)
|
||||
}
|
||||
if !api.ValidNamespace(ctx, &controller.JSONBase) {
|
||||
if !api.ValidNamespace(ctx, &controller.TypeMeta) {
|
||||
return nil, errors.NewConflict("controller", controller.Namespace, fmt.Errorf("Controller.Namespace does not match the provided context"))
|
||||
}
|
||||
if errs := validation.ValidateReplicationController(controller); len(errs) > 0 {
|
||||
|
@@ -50,7 +50,7 @@ func TestListControllersError(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestListEmptyControllerList(t *testing.T) {
|
||||
mockRegistry := registrytest.ControllerRegistry{nil, &api.ReplicationControllerList{JSONBase: api.JSONBase{ResourceVersion: 1}}}
|
||||
mockRegistry := registrytest.ControllerRegistry{nil, &api.ReplicationControllerList{TypeMeta: api.TypeMeta{ResourceVersion: 1}}}
|
||||
storage := REST{
|
||||
registry: &mockRegistry,
|
||||
}
|
||||
@@ -73,12 +73,12 @@ func TestListControllerList(t *testing.T) {
|
||||
Controllers: &api.ReplicationControllerList{
|
||||
Items: []api.ReplicationController{
|
||||
{
|
||||
JSONBase: api.JSONBase{
|
||||
TypeMeta: api.TypeMeta{
|
||||
ID: "foo",
|
||||
},
|
||||
},
|
||||
{
|
||||
JSONBase: api.JSONBase{
|
||||
TypeMeta: api.TypeMeta{
|
||||
ID: "bar",
|
||||
},
|
||||
},
|
||||
@@ -112,7 +112,7 @@ func TestControllerDecode(t *testing.T) {
|
||||
registry: &mockRegistry,
|
||||
}
|
||||
controller := &api.ReplicationController{
|
||||
JSONBase: api.JSONBase{
|
||||
TypeMeta: api.TypeMeta{
|
||||
ID: "foo",
|
||||
},
|
||||
}
|
||||
@@ -133,7 +133,7 @@ func TestControllerDecode(t *testing.T) {
|
||||
|
||||
func TestControllerParsing(t *testing.T) {
|
||||
expectedController := api.ReplicationController{
|
||||
JSONBase: api.JSONBase{
|
||||
TypeMeta: api.TypeMeta{
|
||||
ID: "nginxController",
|
||||
},
|
||||
DesiredState: api.ReplicationControllerState{
|
||||
@@ -224,7 +224,7 @@ func TestCreateController(t *testing.T) {
|
||||
Pods: &api.PodList{
|
||||
Items: []api.Pod{
|
||||
{
|
||||
JSONBase: api.JSONBase{ID: "foo"},
|
||||
TypeMeta: api.TypeMeta{ID: "foo"},
|
||||
Labels: map[string]string{"a": "b"},
|
||||
},
|
||||
},
|
||||
@@ -236,7 +236,7 @@ func TestCreateController(t *testing.T) {
|
||||
pollPeriod: time.Millisecond * 1,
|
||||
}
|
||||
controller := &api.ReplicationController{
|
||||
JSONBase: api.JSONBase{ID: "test"},
|
||||
TypeMeta: api.TypeMeta{ID: "test"},
|
||||
DesiredState: api.ReplicationControllerState{
|
||||
Replicas: 2,
|
||||
ReplicaSelector: map[string]string{"a": "b"},
|
||||
@@ -269,13 +269,13 @@ func TestControllerStorageValidatesCreate(t *testing.T) {
|
||||
}
|
||||
failureCases := map[string]api.ReplicationController{
|
||||
"empty ID": {
|
||||
JSONBase: api.JSONBase{ID: ""},
|
||||
TypeMeta: api.TypeMeta{ID: ""},
|
||||
DesiredState: api.ReplicationControllerState{
|
||||
ReplicaSelector: map[string]string{"bar": "baz"},
|
||||
},
|
||||
},
|
||||
"empty selector": {
|
||||
JSONBase: api.JSONBase{ID: "abc"},
|
||||
TypeMeta: api.TypeMeta{ID: "abc"},
|
||||
DesiredState: api.ReplicationControllerState{},
|
||||
},
|
||||
}
|
||||
@@ -300,13 +300,13 @@ func TestControllerStorageValidatesUpdate(t *testing.T) {
|
||||
}
|
||||
failureCases := map[string]api.ReplicationController{
|
||||
"empty ID": {
|
||||
JSONBase: api.JSONBase{ID: ""},
|
||||
TypeMeta: api.TypeMeta{ID: ""},
|
||||
DesiredState: api.ReplicationControllerState{
|
||||
ReplicaSelector: map[string]string{"bar": "baz"},
|
||||
},
|
||||
},
|
||||
"empty selector": {
|
||||
JSONBase: api.JSONBase{ID: "abc"},
|
||||
TypeMeta: api.TypeMeta{ID: "abc"},
|
||||
DesiredState: api.ReplicationControllerState{},
|
||||
},
|
||||
}
|
||||
@@ -337,8 +337,8 @@ func TestFillCurrentState(t *testing.T) {
|
||||
fakeLister := fakePodLister{
|
||||
l: api.PodList{
|
||||
Items: []api.Pod{
|
||||
{JSONBase: api.JSONBase{ID: "foo"}},
|
||||
{JSONBase: api.JSONBase{ID: "bar"}},
|
||||
{TypeMeta: api.TypeMeta{ID: "foo"}},
|
||||
{TypeMeta: api.TypeMeta{ID: "bar"}},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user