mirror of https://github.com/k3s-io/k3s
Shrink runtime.TypeMeta to be equivalent to api TypeMeta
Remove unused fuzzingpull/6/head
parent
dd24b013cb
commit
714dbf4522
|
@ -48,15 +48,6 @@ var apiObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 1).Funcs(
|
|||
// APIVersion and Kind must remain blank in memory.
|
||||
j.APIVersion = ""
|
||||
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) {
|
||||
// We have to customize the randomization of TypeMetas because their
|
||||
|
|
|
@ -49,15 +49,6 @@ var apiObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 1).Funcs(
|
|||
// APIVersion and Kind must remain blank in memory.
|
||||
j.APIVersion = ""
|
||||
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) {
|
||||
// We have to customize the randomization of TypeMetas because their
|
||||
|
|
|
@ -50,11 +50,11 @@ func TestEmbeddedObject(t *testing.T) {
|
|||
s.AddKnownTypeWithName("v1test", "EmbeddedTest", &EmbeddedTestExternal{})
|
||||
|
||||
outer := &EmbeddedTest{
|
||||
TypeMeta: runtime.TypeMeta{Name: "outer"},
|
||||
TypeMeta: runtime.TypeMeta{},
|
||||
ID: "outer",
|
||||
Object: runtime.EmbeddedObject{
|
||||
&EmbeddedTest{
|
||||
TypeMeta: runtime.TypeMeta{Name: "inner"},
|
||||
TypeMeta: runtime.TypeMeta{},
|
||||
ID: "inner",
|
||||
},
|
||||
},
|
||||
|
@ -83,7 +83,7 @@ func TestEmbeddedObject(t *testing.T) {
|
|||
if err != nil {
|
||||
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)
|
||||
}
|
||||
if !reflect.DeepEqual(externalViaJSON.EmptyObject.RawJSON, []byte("null")) || len(externalViaJSON.Object.RawJSON) == 0 {
|
||||
|
|
|
@ -16,9 +16,7 @@ limitations under the License.
|
|||
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||
)
|
||||
import ()
|
||||
|
||||
// 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.
|
||||
|
@ -35,15 +33,8 @@ import (
|
|||
// your own with the same fields.
|
||||
//
|
||||
type TypeMeta struct {
|
||||
APIVersion string `json:"apiVersion,omitempty"`
|
||||
Kind string `json:"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"`
|
||||
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
|
||||
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
|
||||
}
|
||||
|
||||
// PluginBase is like TypeMeta, but it's intended for plugin objects that won't ever be encoded
|
||||
|
|
Loading…
Reference in New Issue