refactor: use metav1.ObjectMeta in other types

This commit is contained in:
Clayton Coleman
2017-01-16 22:38:19 -05:00
parent 5a5d31555b
commit 9a2a50cda7
822 changed files with 11914 additions and 9290 deletions

View File

@@ -38,7 +38,7 @@ func newStorage(t *testing.T) (*REST, *etcdtesting.EtcdTestServer) {
func validNewNamespace() *api.Namespace {
return &api.Namespace{
ObjectMeta: api.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
},
}
@@ -50,13 +50,13 @@ func TestCreate(t *testing.T) {
defer storage.Store.DestroyFunc()
test := registrytest.New(t, storage.Store).ClusterScope()
namespace := validNewNamespace()
namespace.ObjectMeta = api.ObjectMeta{GenerateName: "foo"}
namespace.ObjectMeta = metav1.ObjectMeta{GenerateName: "foo"}
test.TestCreate(
// valid
namespace,
// invalid
&api.Namespace{
ObjectMeta: api.ObjectMeta{Name: "bad value"},
ObjectMeta: metav1.ObjectMeta{Name: "bad value"},
},
)
}
@@ -145,7 +145,7 @@ func TestDeleteNamespaceWithIncompleteFinalizers(t *testing.T) {
ctx := genericapirequest.NewContext()
now := metav1.Now()
namespace := &api.Namespace{
ObjectMeta: api.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
DeletionTimestamp: &now,
},
@@ -170,7 +170,7 @@ func TestDeleteNamespaceWithCompleteFinalizers(t *testing.T) {
ctx := genericapirequest.NewContext()
now := metav1.Now()
namespace := &api.Namespace{
ObjectMeta: api.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
DeletionTimestamp: &now,
},

View File

@@ -34,7 +34,7 @@ func TestNamespaceStrategy(t *testing.T) {
t.Errorf("Namespaces should not allow create on update")
}
namespace := &api.Namespace{
ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "10"},
ObjectMeta: metav1.ObjectMeta{Name: "foo", ResourceVersion: "10"},
Status: api.NamespaceStatus{Phase: api.NamespaceTerminating},
}
Strategy.PrepareForCreate(ctx, namespace)
@@ -49,7 +49,7 @@ func TestNamespaceStrategy(t *testing.T) {
t.Errorf("Unexpected error validating %v", errs)
}
invalidNamespace := &api.Namespace{
ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "4"},
ObjectMeta: metav1.ObjectMeta{Name: "bar", ResourceVersion: "4"},
}
// ensure we copy spec.finalizers from old to new
Strategy.PrepareForUpdate(ctx, invalidNamespace, namespace)
@@ -75,12 +75,12 @@ func TestNamespaceStatusStrategy(t *testing.T) {
}
now := metav1.Now()
oldNamespace := &api.Namespace{
ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "10", DeletionTimestamp: &now},
ObjectMeta: metav1.ObjectMeta{Name: "foo", ResourceVersion: "10", DeletionTimestamp: &now},
Spec: api.NamespaceSpec{Finalizers: []api.FinalizerName{"kubernetes"}},
Status: api.NamespaceStatus{Phase: api.NamespaceActive},
}
namespace := &api.Namespace{
ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "9", DeletionTimestamp: &now},
ObjectMeta: metav1.ObjectMeta{Name: "foo", ResourceVersion: "9", DeletionTimestamp: &now},
Status: api.NamespaceStatus{Phase: api.NamespaceTerminating},
}
StatusStrategy.PrepareForUpdate(ctx, namespace, oldNamespace)
@@ -108,12 +108,12 @@ func TestNamespaceFinalizeStrategy(t *testing.T) {
t.Errorf("Namespaces should not allow create on update")
}
oldNamespace := &api.Namespace{
ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "10"},
ObjectMeta: metav1.ObjectMeta{Name: "foo", ResourceVersion: "10"},
Spec: api.NamespaceSpec{Finalizers: []api.FinalizerName{"kubernetes", "example.com/org"}},
Status: api.NamespaceStatus{Phase: api.NamespaceActive},
}
namespace := &api.Namespace{
ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "9"},
ObjectMeta: metav1.ObjectMeta{Name: "foo", ResourceVersion: "9"},
Spec: api.NamespaceSpec{Finalizers: []api.FinalizerName{"example.com/foo"}},
Status: api.NamespaceStatus{Phase: api.NamespaceTerminating},
}