Shrink runtime.TypeMeta to be equivalent to api TypeMeta

Remove unused fuzzing
pull/6/head
Clayton Coleman 2014-12-03 08:43:09 -05:00
parent dd24b013cb
commit 714dbf4522
4 changed files with 6 additions and 33 deletions

View File

@ -48,15 +48,6 @@ var apiObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 1).Funcs(
// APIVersion and Kind must remain blank in memory. // APIVersion and Kind must remain blank in memory.
j.APIVersion = "" j.APIVersion = ""
j.Kind = "" j.Kind = ""
j.Name = c.RandString()
j.ResourceVersion = strconv.FormatUint(c.RandUint64(), 10)
j.SelfLink = c.RandString()
var sec, nsec int64
c.Fuzz(&sec)
c.Fuzz(&nsec)
j.CreationTimestamp = util.Unix(sec, nsec).Rfc3339Copy()
}, },
func(j *api.TypeMeta, c fuzz.Continue) { func(j *api.TypeMeta, c fuzz.Continue) {
// We have to customize the randomization of TypeMetas because their // We have to customize the randomization of TypeMetas because their

View File

@ -49,15 +49,6 @@ var apiObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 1).Funcs(
// APIVersion and Kind must remain blank in memory. // APIVersion and Kind must remain blank in memory.
j.APIVersion = "" j.APIVersion = ""
j.Kind = "" j.Kind = ""
j.Name = c.RandString()
j.ResourceVersion = strconv.FormatUint(c.RandUint64(), 10)
j.SelfLink = c.RandString()
var sec, nsec int64
c.Fuzz(&sec)
c.Fuzz(&nsec)
j.CreationTimestamp = util.Unix(sec, nsec).Rfc3339Copy()
}, },
func(j *api.TypeMeta, c fuzz.Continue) { func(j *api.TypeMeta, c fuzz.Continue) {
// We have to customize the randomization of TypeMetas because their // We have to customize the randomization of TypeMetas because their

View File

@ -50,11 +50,11 @@ func TestEmbeddedObject(t *testing.T) {
s.AddKnownTypeWithName("v1test", "EmbeddedTest", &EmbeddedTestExternal{}) s.AddKnownTypeWithName("v1test", "EmbeddedTest", &EmbeddedTestExternal{})
outer := &EmbeddedTest{ outer := &EmbeddedTest{
TypeMeta: runtime.TypeMeta{Name: "outer"}, TypeMeta: runtime.TypeMeta{},
ID: "outer", ID: "outer",
Object: runtime.EmbeddedObject{ Object: runtime.EmbeddedObject{
&EmbeddedTest{ &EmbeddedTest{
TypeMeta: runtime.TypeMeta{Name: "inner"}, TypeMeta: runtime.TypeMeta{},
ID: "inner", ID: "inner",
}, },
}, },
@ -83,7 +83,7 @@ func TestEmbeddedObject(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("Unexpected decode error %v", err) t.Fatalf("Unexpected decode error %v", err)
} }
if externalViaJSON.Kind == "" || externalViaJSON.APIVersion == "" || externalViaJSON.Name != "outer" { if externalViaJSON.Kind == "" || externalViaJSON.APIVersion == "" || externalViaJSON.ID != "outer" {
t.Errorf("Expected objects to have type info set, got %#v", externalViaJSON) t.Errorf("Expected objects to have type info set, got %#v", externalViaJSON)
} }
if !reflect.DeepEqual(externalViaJSON.EmptyObject.RawJSON, []byte("null")) || len(externalViaJSON.Object.RawJSON) == 0 { if !reflect.DeepEqual(externalViaJSON.EmptyObject.RawJSON, []byte("null")) || len(externalViaJSON.Object.RawJSON) == 0 {

View File

@ -16,9 +16,7 @@ limitations under the License.
package runtime package runtime
import ( import ()
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
)
// Note that the types provided in this file are not versioned and are intended to be // Note that the types provided in this file are not versioned and are intended to be
// safe to use from within all versions of every API object. // safe to use from within all versions of every API object.
@ -35,15 +33,8 @@ import (
// your own with the same fields. // your own with the same fields.
// //
type TypeMeta struct { type TypeMeta struct {
APIVersion string `json:"apiVersion,omitempty"` APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
Kind string `json:"kind,omitempty"` Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Namespace string `json:"namespace,omitempty"`
Name string `json:"name,omitempty"`
UID string `json:"uid,omitempty"`
CreationTimestamp util.Time `json:"creationTimestamp,omitempty"`
SelfLink string `json:"selfLink,omitempty"`
ResourceVersion string `json:"resourceVersion,omitempty"`
} }
// PluginBase is like TypeMeta, but it's intended for plugin objects that won't ever be encoded // PluginBase is like TypeMeta, but it's intended for plugin objects that won't ever be encoded