Add UID to MetaAccessor and Ref

This commit is contained in:
Clayton Coleman
2014-10-22 22:59:15 -04:00
parent 1ccb86c760
commit 35eaf90255
6 changed files with 32 additions and 5 deletions

View File

@@ -28,6 +28,7 @@ func TestGenericTypeMeta(t *testing.T) {
type TypeMeta struct {
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
UID string `json:"uid,omitempty" yaml:"uid,omitempty"`
CreationTimestamp util.Time `json:"creationTimestamp,omitempty" yaml:"creationTimestamp,omitempty"`
SelfLink string `json:"selfLink,omitempty" yaml:"selfLink,omitempty"`
ResourceVersion string `json:"resourceVersion,omitempty" yaml:"resourceVersion,omitempty"`
@@ -35,6 +36,7 @@ func TestGenericTypeMeta(t *testing.T) {
}
j := TypeMeta{
Name: "foo",
UID: "uid",
APIVersion: "a",
Kind: "b",
ResourceVersion: "1",
@@ -49,6 +51,9 @@ func TestGenericTypeMeta(t *testing.T) {
if e, a := "foo", jbi.Name(); e != a {
t.Errorf("expected %v, got %v", e, a)
}
if e, a := "uid", jbi.UID(); e != a {
t.Errorf("expected %v, got %v", e, a)
}
if e, a := "a", jbi.APIVersion(); e != a {
t.Errorf("expected %v, got %v", e, a)
}
@@ -63,6 +68,7 @@ func TestGenericTypeMeta(t *testing.T) {
}
jbi.SetName("bar")
jbi.SetUID("other")
jbi.SetAPIVersion("c")
jbi.SetKind("d")
jbi.SetResourceVersion("2")
@@ -72,6 +78,9 @@ func TestGenericTypeMeta(t *testing.T) {
if e, a := "bar", j.Name; e != a {
t.Errorf("expected %v, got %v", e, a)
}
if e, a := "other", j.UID; e != a {
t.Errorf("expected %v, got %v", e, a)
}
if e, a := "c", j.APIVersion; e != a {
t.Errorf("expected %v, got %v", e, a)
}