Unify validation logic for create and update paths

Ensure ObjectMeta is consistently validated on both create and update

Make PortalIP uncleareable
This commit is contained in:
Clayton Coleman
2015-01-27 18:55:54 -05:00
parent 72cc17b41c
commit a0356bca96
9 changed files with 334 additions and 114 deletions

View File

@@ -42,7 +42,7 @@ func TestMinionRegistryREST(t *testing.T) {
c, err := ms.Create(ctx, &api.Node{ObjectMeta: api.ObjectMeta{Name: "baz"}})
if err != nil {
t.Errorf("insert failed")
t.Fatalf("insert failed: %v", err)
}
obj := <-c
if !api.HasObjectMetaSystemFieldValues(&obj.Object.(*api.Node).ObjectMeta) {
@@ -57,7 +57,7 @@ func TestMinionRegistryREST(t *testing.T) {
c, err = ms.Delete(ctx, "bar")
if err != nil {
t.Errorf("delete failed")
t.Fatalf("delete failed")
}
obj = <-c
if s, ok := obj.Object.(*api.Status); !ok || s.Status != api.StatusSuccess {
@@ -69,7 +69,7 @@ func TestMinionRegistryREST(t *testing.T) {
_, err = ms.Delete(ctx, "bar")
if err != ErrDoesNotExist {
t.Errorf("delete returned wrong error")
t.Fatalf("delete returned wrong error")
}
list, err := ms.List(ctx, labels.Everything(), labels.Everything())
@@ -103,7 +103,7 @@ func TestMinionRegistryHealthCheck(t *testing.T) {
c, err := ms.Create(ctx, &api.Node{ObjectMeta: api.ObjectMeta{Name: "m1"}})
if err != nil {
t.Errorf("insert failed")
t.Fatalf("insert failed: %v", err)
}
result := <-c
if m, ok := result.Object.(*api.Node); !ok || m.Name != "m1" {